get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 65738,
    "url": "http://patches.dpdk.org/api/patches/65738/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/158146235133.16827.7215789038918853214.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": "<158146235133.16827.7215789038918853214.stgit@gimli.home>",
    "list_archive_url": "https://inbox.dpdk.org/dev/158146235133.16827.7215789038918853214.stgit@gimli.home",
    "date": "2020-02-11T23:05:51",
    "name": "[4/7] vfio: Introduce VFIO_DEVICE_FEATURE ioctl and first user",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "99b6b589aa8d9bd4f91db5a4b0ad09ec61e3a9cc",
    "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/158146235133.16827.7215789038918853214.stgit@gimli.home/mbox/",
    "series": [
        {
            "id": 8504,
            "url": "http://patches.dpdk.org/api/series/8504/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8504",
            "date": "2020-02-11T23:05:16",
            "name": "vfio/pci: SR-IOV support",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8504/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65738/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/65738/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 B3C05A0530;\n\tWed, 12 Feb 2020 00:06:08 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 817BD2B87;\n\tWed, 12 Feb 2020 00:06:04 +0100 (CET)",
            "from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com\n [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 673F72B87\n for <dev@dpdk.org>; Wed, 12 Feb 2020 00:06:02 +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-160-d2Gkq4rFN-yYNZBVxKuSkQ-1; Tue, 11 Feb 2020 18:05:56 -0500",
            "from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com\n [10.5.11.23])\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 DF411800EB2;\n Tue, 11 Feb 2020 23:05:54 +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 B902426FAA;\n Tue, 11 Feb 2020 23:05:51 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1581462361;\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=euk0LJLXtslM2hWqkPSQesMItzrYYYlSLZ2gYZ8UrSA=;\n b=MvOdgGzmWIKmihnFINvNYOK3mQxXXyMVlEd72GQJi0XVP2+SfXv6cEZfmYZX/1da8YgD8p\n SY21rNMWLvzGeB7gIDv+rVG3Vs9bheT3WhGXsxoiGGlf3udcE1v+grQYc6aOY1lU3zFSuc\n g2ZlpAB6uTTuwghiKShZ93XBHJuQZpI=",
        "X-MC-Unique": "d2Gkq4rFN-yYNZBVxKuSkQ-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",
        "Date": "Tue, 11 Feb 2020 16:05:51 -0700",
        "Message-ID": "<158146235133.16827.7215789038918853214.stgit@gimli.home>",
        "In-Reply-To": "<158145472604.16827.15751375540102298130.stgit@gimli.home>",
        "References": "<158145472604.16827.15751375540102298130.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.84 on 10.5.11.23",
        "Subject": "[dpdk-dev] [PATCH 4/7] vfio: Introduce VFIO_DEVICE_FEATURE ioctl\n\tand 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 |   52 +++++++++++++++++++++++++++++++++++++++++++\n include/uapi/linux/vfio.h   |   37 +++++++++++++++++++++++++++++++\n 2 files changed, 89 insertions(+)",
    "diff": "diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c\nindex 26aea9ac4863..5414744a3ead 100644\n--- a/drivers/vfio/pci/vfio_pci.c\n+++ b/drivers/vfio/pci/vfio_pci.c\n@@ -1171,6 +1171,58 @@ 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\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\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..c5cbf04ce5a7 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": [
        "4/7"
    ]
}