get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/66552/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 66552,
    "url": "http://patches.dpdk.org/api/patches/66552/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/158396394121.5601.17199100619127784408.stgit@gimli.home/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<158396394121.5601.17199100619127784408.stgit@gimli.home>",
    "list_archive_url": "https://inbox.dpdk.org/dev/158396394121.5601.17199100619127784408.stgit@gimli.home",
    "date": "2020-03-11T21:59:01",
    "name": "[v3,4/7] vfio: Introduce VFIO_DEVICE_FEATURE ioctl and first user",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "2b59fef62e9144997a7537ce4240530999893ec3",
    "submitter": {
        "id": 391,
        "url": "http://patches.dpdk.org/api/people/391/?format=api",
        "name": "Alex Williamson",
        "email": "alex.williamson@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/158396394121.5601.17199100619127784408.stgit@gimli.home/mbox/",
    "series": [
        {
            "id": 8887,
            "url": "http://patches.dpdk.org/api/series/8887/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8887",
            "date": "2020-03-11T21:58:25",
            "name": "vfio/pci: SR-IOV support",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/8887/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/66552/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/66552/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8B417A056D;\n\tWed, 11 Mar 2020 22:59:18 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 65D071C02A;\n\tWed, 11 Mar 2020 22:59:13 +0100 (CET)",
            "from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com\n [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 5EB693B5\n for <dev@dpdk.org>; Wed, 11 Mar 2020 22:59:12 +0100 (CET)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-56-wlyC5NHSM329I1G76lfF0A-1; Wed, 11 Mar 2020 17:59:08 -0400",
            "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com\n [10.5.11.14])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1397618A5500;\n Wed, 11 Mar 2020 21:59:07 +0000 (UTC)",
            "from gimli.home (ovpn-116-28.phx2.redhat.com [10.3.116.28])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 98C625D9CA;\n Wed, 11 Mar 2020 21:59:01 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1583963951;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=ygC90L0h2cxFSRxMqISxGR2WaxbybOnVdGFkzLExh70=;\n b=N7fs+/k576YU32X1k23S/KNP+Wp8nrezUdl/9tVruYT+jm0CPnbHDUKSkSLKoClC50NY1K\n BwO4iaYjHPYOYbhFguVpk1vJ+TD+UpOGlKGHN8M68TSjjwJbP5C1ll90Ix5LCg/iaqMStD\n WOwHG9HYUIcAQROyK4QibgOVgv6ojXc=",
        "X-MC-Unique": "wlyC5NHSM329I1G76lfF0A-1",
        "From": "Alex Williamson <alex.williamson@redhat.com>",
        "To": "kvm@vger.kernel.org",
        "Cc": "linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dev@dpdk.org,\n mtosatti@redhat.com, thomas@monjalon.net, bluca@debian.org,\n jerinjacobk@gmail.com, bruce.richardson@intel.com, cohuck@redhat.com,\n kevin.tian@intel.com",
        "Date": "Wed, 11 Mar 2020 15:59:01 -0600",
        "Message-ID": "<158396394121.5601.17199100619127784408.stgit@gimli.home>",
        "In-Reply-To": "<158396044753.5601.14804870681174789709.stgit@gimli.home>",
        "References": "<158396044753.5601.14804870681174789709.stgit@gimli.home>",
        "User-Agent": "StGit/0.19-dirty",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14",
        "Subject": "[dpdk-dev] [PATCH v3 4/7] vfio: Introduce VFIO_DEVICE_FEATURE ioctl\n and first user",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The VFIO_DEVICE_FEATURE ioctl is meant to be a general purpose, device\nagnostic ioctl for setting, retrieving, and probing device features.\nThis implementation provides a 16-bit field for specifying a feature\nindex, where the data porition of the ioctl is determined by the\nsemantics for the given feature.  Additional flag bits indicate the\ndirection and nature of the operation; SET indicates user data is\nprovided into the device feature, GET indicates the device feature is\nwritten out into user data.  The PROBE flag augments determining\nwhether the given feature is supported, and if provided, whether the\ngiven operation on the feature is supported.\n\nThe first user of this ioctl is for setting the vfio-pci VF token,\nwhere the user provides a shared secret key (UUID) on a SR-IOV PF\ndevice, which users must provide when opening associated VF devices.\n\nSigned-off-by: Alex Williamson <alex.williamson@redhat.com>\n---\n drivers/vfio/pci/vfio_pci.c |   59 +++++++++++++++++++++++++++++++++++++++++++\n include/uapi/linux/vfio.h   |   37 +++++++++++++++++++++++++++\n 2 files changed, 96 insertions(+)",
    "diff": "diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c\nindex 5277c6c2fa72..6c28860f768a 100644\n--- a/drivers/vfio/pci/vfio_pci.c\n+++ b/drivers/vfio/pci/vfio_pci.c\n@@ -1180,6 +1180,65 @@ static long vfio_pci_ioctl(void *device_data,\n \n \t\treturn vfio_pci_ioeventfd(vdev, ioeventfd.offset,\n \t\t\t\t\t  ioeventfd.data, count, ioeventfd.fd);\n+\t} else if (cmd == VFIO_DEVICE_FEATURE) {\n+\t\tstruct vfio_device_feature feature;\n+\t\tuuid_t uuid;\n+\n+\t\tminsz = offsetofend(struct vfio_device_feature, flags);\n+\n+\t\tif (copy_from_user(&feature, (void __user *)arg, minsz))\n+\t\t\treturn -EFAULT;\n+\n+\t\tif (feature.argsz < minsz)\n+\t\t\treturn -EINVAL;\n+\n+\t\t/* Check unknown flags */\n+\t\tif (feature.flags & ~(VFIO_DEVICE_FEATURE_MASK |\n+\t\t\t\t      VFIO_DEVICE_FEATURE_SET |\n+\t\t\t\t      VFIO_DEVICE_FEATURE_GET |\n+\t\t\t\t      VFIO_DEVICE_FEATURE_PROBE))\n+\t\t\treturn -EINVAL;\n+\n+\t\t/* GET & SET are mutually exclusive except with PROBE */\n+\t\tif (!(feature.flags & VFIO_DEVICE_FEATURE_PROBE) &&\n+\t\t    (feature.flags & VFIO_DEVICE_FEATURE_SET) &&\n+\t\t    (feature.flags & VFIO_DEVICE_FEATURE_GET))\n+\t\t\treturn -EINVAL;\n+\n+\t\tswitch (feature.flags & VFIO_DEVICE_FEATURE_MASK) {\n+\t\tcase VFIO_DEVICE_FEATURE_PCI_VF_TOKEN:\n+\t\t\tif (!vdev->vf_token)\n+\t\t\t\treturn -ENOTTY;\n+\n+\t\t\t/*\n+\t\t\t * We do not support GET of the VF Token UUID as this\n+\t\t\t * could expose the token of the previous device user.\n+\t\t\t */\n+\t\t\tif (feature.flags & VFIO_DEVICE_FEATURE_GET)\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tif (feature.flags & VFIO_DEVICE_FEATURE_PROBE)\n+\t\t\t\treturn 0;\n+\n+\t\t\t/* Don't SET unless told to do so */\n+\t\t\tif (!(feature.flags & VFIO_DEVICE_FEATURE_SET))\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tif (feature.argsz < minsz + sizeof(uuid))\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tif (copy_from_user(&uuid, (void __user *)(arg + minsz),\n+\t\t\t\t\t   sizeof(uuid)))\n+\t\t\t\treturn -EFAULT;\n+\n+\t\t\tmutex_lock(&vdev->vf_token->lock);\n+\t\t\tuuid_copy(&vdev->vf_token->uuid, &uuid);\n+\t\t\tmutex_unlock(&vdev->vf_token->lock);\n+\n+\t\t\treturn 0;\n+\t\tdefault:\n+\t\t\treturn -ENOTTY;\n+\t\t}\n \t}\n \n \treturn -ENOTTY;\ndiff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h\nindex 9e843a147ead..aa37f90a2180 100644\n--- a/include/uapi/linux/vfio.h\n+++ b/include/uapi/linux/vfio.h\n@@ -707,6 +707,43 @@ struct vfio_device_ioeventfd {\n \n #define VFIO_DEVICE_IOEVENTFD\t\t_IO(VFIO_TYPE, VFIO_BASE + 16)\n \n+/**\n+ * VFIO_DEVICE_FEATURE - _IORW(VFIO_TYPE, VFIO_BASE + 17,\n+ *\t\t\t       struct vfio_device_feature)\n+ *\n+ * Get, set, or probe feature data of the device.  The feature is selected\n+ * using the FEATURE_MASK portion of the flags field.  Support for a feature\n+ * can be probed by setting both the FEATURE_MASK and PROBE bits.  A probe\n+ * may optionally include the GET and/or SET bits to determine read vs write\n+ * access of the feature respectively.  Probing a feature will return success\n+ * if the feature is supported and all of the optionally indicated GET/SET\n+ * methods are supported.  The format of the data portion of the structure is\n+ * specific to the given feature.  The data portion is not required for\n+ * probing.\n+ *\n+ * Return 0 on success, -errno on failure.\n+ */\n+struct vfio_device_feature {\n+\t__u32\targsz;\n+\t__u32\tflags;\n+#define VFIO_DEVICE_FEATURE_MASK\t(0xffff) /* 16-bit feature index */\n+#define VFIO_DEVICE_FEATURE_GET\t\t(1 << 16) /* Get feature into data[] */\n+#define VFIO_DEVICE_FEATURE_SET\t\t(1 << 17) /* Set feature from data[] */\n+#define VFIO_DEVICE_FEATURE_PROBE\t(1 << 18) /* Probe feature support */\n+\t__u8\tdata[];\n+};\n+\n+#define VFIO_DEVICE_FEATURE\t\t_IO(VFIO_TYPE, VFIO_BASE + 17)\n+\n+/*\n+ * Provide support for setting a PCI VF Token, which is used as a shared\n+ * secret between PF and VF drivers.  This feature may only be set on a\n+ * PCI SR-IOV PF when SR-IOV is enabled on the PF and there are no existing\n+ * open VFs.  Data provided when setting this feature is a 16-byte array\n+ * (__u8 b[16]), representing a UUID.\n+ */\n+#define VFIO_DEVICE_FEATURE_PCI_VF_TOKEN\t(0)\n+\n /* -------- API for Type1 VFIO IOMMU -------- */\n \n /**\n",
    "prefixes": [
        "v3",
        "4/7"
    ]
}