get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 964067,
    "url": "http://patchwork.ozlabs.org/api/patches/964067/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180830185352.3369-3-logang@deltatee.com/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api",
        "name": "Linux PCI development",
        "link_name": "linux-pci",
        "list_id": "linux-pci.vger.kernel.org",
        "list_email": "linux-pci@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20180830185352.3369-3-logang@deltatee.com>",
    "list_archive_url": null,
    "date": "2018-08-30T18:53:41",
    "name": "[v5,02/13] PCI/P2PDMA: Add sysfs group to display p2pmem stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "1ff07f498600f904f3887d2fbc871f96a98d4f4d",
    "submitter": {
        "id": 70191,
        "url": "http://patchwork.ozlabs.org/api/people/70191/?format=api",
        "name": "Logan Gunthorpe",
        "email": "logang@deltatee.com"
    },
    "delegate": {
        "id": 6763,
        "url": "http://patchwork.ozlabs.org/api/users/6763/?format=api",
        "username": "bhelgaas",
        "first_name": "Bjorn",
        "last_name": "Helgaas",
        "email": "bhelgaas@google.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180830185352.3369-3-logang@deltatee.com/mbox/",
    "series": [
        {
            "id": 63352,
            "url": "http://patchwork.ozlabs.org/api/series/63352/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=63352",
            "date": "2018-08-30T18:53:41",
            "name": "Copy Offload in NVMe Fabrics with P2P PCI Memory",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/63352/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/964067/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/964067/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-pci-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=deltatee.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 421Wqj1bYdz9s0n\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 31 Aug 2018 04:54:09 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1727501AbeH3W5l (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 30 Aug 2018 18:57:41 -0400",
            "from ale.deltatee.com ([207.54.116.67]:40076 \"EHLO\n\tale.deltatee.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1726122AbeH3W5l (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tThu, 30 Aug 2018 18:57:41 -0400",
            "from cgy1-donard.priv.deltatee.com ([172.16.1.31])\n\tby ale.deltatee.com with esmtps\n\t(TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)\n\t(envelope-from <gunthorp@deltatee.com>)\n\tid 1fvS4t-0006Oh-Nd; Thu, 30 Aug 2018 12:54:05 -0600",
            "from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim\n\t4.89) (envelope-from <gunthorp@deltatee.com>)\n\tid 1fvS4o-0000tK-AQ; Thu, 30 Aug 2018 12:53:54 -0600"
        ],
        "From": "Logan Gunthorpe <logang@deltatee.com>",
        "To": "linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,\n\tlinux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org,\n\tlinux-nvdimm@lists.01.org, linux-block@vger.kernel.org",
        "Cc": "Stephen Bates <sbates@raithlin.com>, Christoph Hellwig <hch@lst.de>,\n\tKeith Busch <keith.busch@intel.com>, Sagi Grimberg <sagi@grimberg.me>,\n\tBjorn Helgaas <bhelgaas@google.com>, Jason Gunthorpe <jgg@mellanox.com>, \n\tMax Gurtovoy <maxg@mellanox.com>,\n\tDan Williams <dan.j.williams@intel.com>, =?utf-8?b?SsOpcsO0bWUgR2xp?=\n\t=?utf-8?q?sse?= <jglisse@redhat.com>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>, Alex Williamson\n\t<alex.williamson@redhat.com>, =?utf-8?q?Christian_K=C3=B6nig?=\n\t<christian.koenig@amd.com>, Logan Gunthorpe <logang@deltatee.com>",
        "Date": "Thu, 30 Aug 2018 12:53:41 -0600",
        "Message-Id": "<20180830185352.3369-3-logang@deltatee.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20180830185352.3369-1-logang@deltatee.com>",
        "References": "<20180830185352.3369-1-logang@deltatee.com>",
        "X-SA-Exim-Connect-IP": "172.16.1.31",
        "X-SA-Exim-Rcpt-To": "linux-nvme@lists.infradead.org, linux-nvdimm@lists.01.org,\n\tlinux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,\n\tlinux-rdma@vger.kernel.org, linux-block@vger.kernel.org,\n\tsbates@raithlin.com, hch@lst.de, sagi@grimberg.me,\n\tbhelgaas@google.com, jgg@mellanox.com, maxg@mellanox.com,\n\tkeith.busch@intel.com, dan.j.williams@intel.com,\n\tbenh@kernel.crashing.org, jglisse@redhat.com,\n\talex.williamson@redhat.com, christian.koenig@amd.com,\n\tlogang@deltatee.com",
        "X-SA-Exim-Mail-From": "gunthorp@deltatee.com",
        "X-Spam-Checker-Version": "SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-8.5 required=5.0 tests=ALL_TRUSTED,BAYES_00,\n\tGREYLIST_ISWHITE,MYRULES_FREE,MYRULES_NO_TEXT autolearn=ham\n\tautolearn_force=no version=3.4.1",
        "Subject": "[PATCH v5 02/13] PCI/P2PDMA: Add sysfs group to display p2pmem stats",
        "X-SA-Exim-Version": "4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000)",
        "X-SA-Exim-Scanned": "Yes (on ale.deltatee.com)",
        "Sender": "linux-pci-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-pci.vger.kernel.org>",
        "X-Mailing-List": "linux-pci@vger.kernel.org"
    },
    "content": "Add a sysfs group to display statistics about P2P memory that is\nregistered in each PCI device.\n\nAttributes in the group display the total amount of P2P memory, the\namount available and whether it is published or not.\n\nSigned-off-by: Logan Gunthorpe <logang@deltatee.com>\n---\n Documentation/ABI/testing/sysfs-bus-pci | 25 +++++++++++++++\n drivers/pci/p2pdma.c                    | 54 +++++++++++++++++++++++++++++++++\n 2 files changed, 79 insertions(+)",
    "diff": "diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci\nindex 44d4b2be92fd..044812c816d0 100644\n--- a/Documentation/ABI/testing/sysfs-bus-pci\n+++ b/Documentation/ABI/testing/sysfs-bus-pci\n@@ -323,3 +323,28 @@ Description:\n \n \t\tThis is similar to /sys/bus/pci/drivers_autoprobe, but\n \t\taffects only the VFs associated with a specific PF.\n+\n+What:\t\t/sys/bus/pci/devices/.../p2pmem/available\n+Date:\t\tNovember 2017\n+Contact:\tLogan Gunthorpe <logang@deltatee.com>\n+Description:\n+\t\tIf the device has any Peer-to-Peer memory registered, this\n+\t        file contains the amount of memory that has not been\n+\t\tallocated (in decimal).\n+\n+What:\t\t/sys/bus/pci/devices/.../p2pmem/size\n+Date:\t\tNovember 2017\n+Contact:\tLogan Gunthorpe <logang@deltatee.com>\n+Description:\n+\t\tIf the device has any Peer-to-Peer memory registered, this\n+\t        file contains the total amount of memory that the device\n+\t\tprovides (in decimal).\n+\n+What:\t\t/sys/bus/pci/devices/.../p2pmem/published\n+Date:\t\tNovember 2017\n+Contact:\tLogan Gunthorpe <logang@deltatee.com>\n+Description:\n+\t\tIf the device has any Peer-to-Peer memory registered, this\n+\t        file contains a '1' if the memory has been published for\n+\t\tuse inside the kernel or a '0' if it is only intended\n+\t\tfor use within the driver that published it.\ndiff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c\nindex 88aaec5351cd..67c1daf1189e 100644\n--- a/drivers/pci/p2pdma.c\n+++ b/drivers/pci/p2pdma.c\n@@ -25,6 +25,54 @@ struct pci_p2pdma {\n \tbool p2pmem_published;\n };\n \n+static ssize_t size_show(struct device *dev, struct device_attribute *attr,\n+\t\t\t char *buf)\n+{\n+\tstruct pci_dev *pdev = to_pci_dev(dev);\n+\tsize_t size = 0;\n+\n+\tif (pdev->p2pdma->pool)\n+\t\tsize = gen_pool_size(pdev->p2pdma->pool);\n+\n+\treturn snprintf(buf, PAGE_SIZE, \"%zd\\n\", size);\n+}\n+static DEVICE_ATTR_RO(size);\n+\n+static ssize_t available_show(struct device *dev, struct device_attribute *attr,\n+\t\t\t      char *buf)\n+{\n+\tstruct pci_dev *pdev = to_pci_dev(dev);\n+\tsize_t avail = 0;\n+\n+\tif (pdev->p2pdma->pool)\n+\t\tavail = gen_pool_avail(pdev->p2pdma->pool);\n+\n+\treturn snprintf(buf, PAGE_SIZE, \"%zd\\n\", avail);\n+}\n+static DEVICE_ATTR_RO(available);\n+\n+static ssize_t published_show(struct device *dev, struct device_attribute *attr,\n+\t\t\t      char *buf)\n+{\n+\tstruct pci_dev *pdev = to_pci_dev(dev);\n+\n+\treturn snprintf(buf, PAGE_SIZE, \"%d\\n\",\n+\t\t\tpdev->p2pdma->p2pmem_published);\n+}\n+static DEVICE_ATTR_RO(published);\n+\n+static struct attribute *p2pmem_attrs[] = {\n+\t&dev_attr_size.attr,\n+\t&dev_attr_available.attr,\n+\t&dev_attr_published.attr,\n+\tNULL,\n+};\n+\n+static const struct attribute_group p2pmem_group = {\n+\t.attrs = p2pmem_attrs,\n+\t.name = \"p2pmem\",\n+};\n+\n static void pci_p2pdma_percpu_release(struct percpu_ref *ref)\n {\n \tstruct pci_p2pdma *p2p =\n@@ -54,6 +102,7 @@ static void pci_p2pdma_release(void *data)\n \tpercpu_ref_exit(&pdev->p2pdma->devmap_ref);\n \n \tgen_pool_destroy(pdev->p2pdma->pool);\n+\tsysfs_remove_group(&pdev->dev.kobj, &p2pmem_group);\n \tpdev->p2pdma = NULL;\n }\n \n@@ -84,9 +133,14 @@ static int pci_p2pdma_setup(struct pci_dev *pdev)\n \n \tpdev->p2pdma = p2p;\n \n+\terror = sysfs_create_group(&pdev->dev.kobj, &p2pmem_group);\n+\tif (error)\n+\t\tgoto out_pool_destroy;\n+\n \treturn 0;\n \n out_pool_destroy:\n+\tpdev->p2pdma = NULL;\n \tgen_pool_destroy(p2p->pool);\n out:\n \tdevm_kfree(&pdev->dev, p2p);\n",
    "prefixes": [
        "v5",
        "02/13"
    ]
}