Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/964071/?format=api
{ "id": 964071, "url": "http://patchwork.ozlabs.org/api/patches/964071/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180830185352.3369-5-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-5-logang@deltatee.com>", "list_archive_url": null, "date": "2018-08-30T18:53:43", "name": "[v5,04/13] PCI/P2PDMA: Introduce configfs/sysfs enable attribute helpers", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "b68247cc51455f92847751074feb4d450bffc38b", "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-5-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/964071/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/964071/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 421Wr20ssQz9s1x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 31 Aug 2018 04:54:26 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1727981AbeH3W5o (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 30 Aug 2018 18:57:44 -0400", "from ale.deltatee.com ([207.54.116.67]:40128 \"EHLO\n\tale.deltatee.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1727965AbeH3W5o (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tThu, 30 Aug 2018 18:57:44 -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-0006Oj-Nc; Thu, 30 Aug 2018 12:54:09 -0600", "from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim\n\t4.89) (envelope-from <gunthorp@deltatee.com>)\n\tid 1fvS4o-0000tQ-HV; 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:43 -0600", "Message-Id": "<20180830185352.3369-5-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 04/13] PCI/P2PDMA: Introduce configfs/sysfs enable\n\tattribute helpers", "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": "Users of the P2PDMA infrastructure will typically need a way for\nthe user to tell the kernel to use P2P resources. Typically\nthis will be a simple on/off boolean operation but sometimes\nit may be desirable for the user to specify the exact device to\nuse for the P2P operation.\n\nAdd new helpers for attributes which take a boolean or a PCI device.\nAny boolean, or the word 'auto' turn P2P on or off. Specifying a full\nPCI device name/BDF will select the specific device.\n\nSigned-off-by: Logan Gunthorpe <logang@deltatee.com>\n---\n drivers/pci/p2pdma.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++\n include/linux/pci-p2pdma.h | 15 +++++++++\n 2 files changed, 98 insertions(+)", "diff": "diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c\nindex 29bd40a87768..3da848f3fe72 100644\n--- a/drivers/pci/p2pdma.c\n+++ b/drivers/pci/p2pdma.c\n@@ -9,6 +9,7 @@\n */\n \n #define pr_fmt(fmt) \"pci-p2pdma: \" fmt\n+#include <linux/ctype.h>\n #include <linux/pci-p2pdma.h>\n #include <linux/module.h>\n #include <linux/slab.h>\n@@ -856,3 +857,85 @@ int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg, int nents,\n \treturn nents;\n }\n EXPORT_SYMBOL_GPL(pci_p2pdma_map_sg);\n+\n+/**\n+ * pci_p2pdma_enable_store - parse a configfs/sysfs attribute store\n+ *\t\tto enable p2pdma\n+ * @page: contents of the value to be stored\n+ * @p2p_dev: returns the PCI device that was selected to be used\n+ *\t\t(if 'auto', 'none or a boolean isn't the store value)\n+ * @use_p2pdma: returns whether to enable p2pdma or not\n+ *\n+ * Parses an attribute value to decide whether to enable p2pdma.\n+ * The value can select a PCI device (using it's full BDF device\n+ * name), a boolean, or 'auto'. 'auto' and a true boolean value\n+ * have the same meaning. A false value disables p2pdma and\n+ * a PCI device enables it to use a specific device as the\n+ * backing provider.\n+ *\n+ * pci_p2pdma_enable_show() should be used as the show operation for\n+ * the attribute.\n+ *\n+ * Returns 0 on success\n+ */\n+int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev,\n+\t\t\t bool *use_p2pdma)\n+{\n+\tstruct device *dev;\n+\n+\tdev = bus_find_device_by_name(&pci_bus_type, NULL, page);\n+\tif (dev) {\n+\t\t*use_p2pdma = true;\n+\t\t*p2p_dev = to_pci_dev(dev);\n+\n+\t\tif (!pci_has_p2pmem(*p2p_dev)) {\n+\t\t\tpr_err(\"PCI device has no peer-to-peer memory: %s\\n\",\n+\t\t\t page);\n+\t\t\tpci_dev_put(*p2p_dev);\n+\t\t\treturn -ENODEV;\n+\t\t}\n+\n+\t\treturn 0;\n+\t} else if (sysfs_streq(page, \"auto\")) {\n+\t\t*use_p2pdma = true;\n+\t\treturn 0;\n+\t} else if ((page[0] == '0' || page[0] == '1') && !iscntrl(page[1])) {\n+\t\t/*\n+\t\t * If the user enters a PCI device that doesn't exist\n+\t\t * like \"0000:01:00.1\", we don't want strtobool to think\n+\t\t * it's a '0' when it's clearly not what the user wanted.\n+\t\t * So we require 0's and 1's to be exactly one character.\n+\t\t */\n+\t} else if (!strtobool(page, use_p2pdma)) {\n+\t\treturn 0;\n+\t}\n+\n+\tpr_err(\"No such PCI device: %.*s\\n\", (int)strcspn(page, \"\\n\"), page);\n+\treturn -ENODEV;\n+}\n+EXPORT_SYMBOL_GPL(pci_p2pdma_enable_store);\n+\n+/**\n+ * pci_p2pdma_enable_show - show a configfs/sysfs attribute indicating\n+ *\t\twhether p2pdma is enabled\n+ * @page: contents of the stored value\n+ * @p2p_dev: the selected p2p device (NULL if no device is selected)\n+ * @use_p2pdma: whether p2pdme has been enabled\n+ *\n+ * Attributes that use pci_p2pdma_enable_store() should use this function\n+ * to show the value of the attribute.\n+ *\n+ * Returns 0 on success\n+ */\n+ssize_t pci_p2pdma_enable_show(char *page, struct pci_dev *p2p_dev,\n+\t\t\t bool use_p2pdma)\n+{\n+\tif (!use_p2pdma)\n+\t\treturn sprintf(page, \"none\\n\");\n+\n+\tif (!p2p_dev)\n+\t\treturn sprintf(page, \"auto\\n\");\n+\n+\treturn sprintf(page, \"%s\\n\", pci_name(p2p_dev));\n+}\n+EXPORT_SYMBOL_GPL(pci_p2pdma_enable_show);\ndiff --git a/include/linux/pci-p2pdma.h b/include/linux/pci-p2pdma.h\nindex 2f03dbbf5af6..377de4d73767 100644\n--- a/include/linux/pci-p2pdma.h\n+++ b/include/linux/pci-p2pdma.h\n@@ -38,6 +38,10 @@ void pci_p2pmem_free_sgl(struct pci_dev *pdev, struct scatterlist *sgl);\n void pci_p2pmem_publish(struct pci_dev *pdev, bool publish);\n int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg, int nents,\n \t\t enum dma_data_direction dir);\n+int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev,\n+\t\t\t bool *use_p2pdma);\n+ssize_t pci_p2pdma_enable_show(char *page, struct pci_dev *p2p_dev,\n+\t\t\t bool use_p2pdma);\n #else /* CONFIG_PCI_P2PDMA */\n static inline int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar,\n \t\tsize_t size, u64 offset)\n@@ -105,5 +109,16 @@ static inline int pci_p2pdma_map_sg(struct device *dev,\n {\n \treturn 0;\n }\n+static inline int pci_p2pdma_enable_store(const char *page,\n+\t\tstruct pci_dev **p2p_dev, bool *use_p2pdma)\n+{\n+\t*use_p2pdma = false;\n+\treturn 0;\n+}\n+static inline ssize_t pci_p2pdma_enable_show(char *page,\n+\t\tstruct pci_dev *p2p_dev, bool use_p2pdma)\n+{\n+\treturn sprintf(page, \"none\\n\");\n+}\n #endif /* CONFIG_PCI_P2PDMA */\n #endif /* _LINUX_PCI_P2P_H */\n", "prefixes": [ "v5", "04/13" ] }