{"id":815140,"url":"http://patchwork.ozlabs.org/api/patches/815140/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170918192651.78404-2-bryantly@linux.vnet.ibm.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170918192651.78404-2-bryantly@linux.vnet.ibm.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170918192651.78404-2-bryantly@linux.vnet.ibm.com/","date":"2017-09-18T19:26:49","name":"[v1,1/3] powerpc/kernel: Split up pci_bus_add_device","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"f53d160add202cc3520e28ae946bfcd8bc64dd1b","submitter":{"id":72247,"url":"http://patchwork.ozlabs.org/api/people/72247/?format=json","name":"Bryant G. Ly","email":"bryantly@linux.vnet.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170918192651.78404-2-bryantly@linux.vnet.ibm.com/mbox/","series":[{"id":3719,"url":"http://patchwork.ozlabs.org/api/series/3719/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=3719","date":"2017-09-18T19:26:48","name":"Prepartion for SR-IOV PowerVM Enablement","version":1,"mbox":"http://patchwork.ozlabs.org/series/3719/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815140/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815140/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwx541yRhz9s5L\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 05:33:44 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xwx536gRRzDqJq\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 05:33:43 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xwwxt5z2gzDqBd\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 19 Sep 2017 05:27:30 +1000 (AEST)","from pps.filterd (m0098399.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8IJOUIs138944\n\tfor <linuxppc-dev@lists.ozlabs.org>; Mon, 18 Sep 2017 15:27:28 -0400","from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2d2m88g6ux-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Mon, 18 Sep 2017 15:27:28 -0400","from localhost\n\tby e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from\n\t<bryantly@linux.vnet.ibm.com>; Mon, 18 Sep 2017 15:27:27 -0400","from b01cxnp22036.gho.pok.ibm.com (9.57.198.26)\n\tby e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tMon, 18 Sep 2017 15:27:23 -0400","from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com\n\t[9.57.199.107])\n\tby b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP\n\tid v8IJRM9G49676372; Mon, 18 Sep 2017 19:27:22 GMT","from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 15EA612403D;\n\tMon, 18 Sep 2017 15:24:39 -0400 (EDT)","from bryants-mbp-3.rchland.ibm.com (unknown [9.10.79.138])\n\tby b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id 9EA87124037;\n\tMon, 18 Sep 2017 15:24:38 -0400 (EDT)"],"Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com\n\t(client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=bryantly@linux.vnet.ibm.com; receiver=<UNKNOWN>)","From":"\"Bryant G. Ly\" <bryantly@linux.vnet.ibm.com>","To":"bhelgaas@google.com, benh@kernel.crashing.org, paulus@samba.org,\n\tmpe@ellerman.id.au","Subject":"[PATCH v1 1/3] powerpc/kernel: Split up pci_bus_add_device","Date":"Mon, 18 Sep 2017 14:26:49 -0500","X-Mailer":"git-send-email 2.11.0 (Apple Git-81)","In-Reply-To":"<20170918192651.78404-1-bryantly@linux.vnet.ibm.com>","References":"<20170918192651.78404-1-bryantly@linux.vnet.ibm.com>","X-TM-AS-GCONF":"00","x-cbid":"17091819-0048-0000-0000-000001E72724","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007757; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000230; SDB=6.00918923; UDB=6.00461645;\n\tIPR=6.00699151; \n\tBA=6.00005595; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017199;\n\tXFM=3.00000015; UTC=2017-09-18 19:27:25","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17091819-0049-0000-0000-0000429A36F0","Message-Id":"<20170918192651.78404-2-bryantly@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-18_08:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709180274","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n\t\"Bryant G. Ly\" <bryantly@linux.vnet.ibm.com>,\n\t\"Juan J . Alvarez\" <jjalvare@us.ibm.com>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"When enabling SR-IOV one might want to have their\nown version of starting device drivers for the VFs.\nThis patch allows for SR-IOV callers to use\npci_bus_add_virtfn_device instead of generic\npci_bus_add_device.\n\nWhen enabling SR-IOV in PSeries architecture the\ndynamic VFs created within the sriov_configure sysfs call\nwill not load the device driver as firmware will load\nthe device node when the VF device is assigned to the\nlogical partition. So we needed a way to overwrite the\nway device driver matching is done for virtual functions\non powervm.\n\nSigned-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>\nSigned-off-by: Juan J. Alvarez <jjalvare@us.ibm.com>\n---\n drivers/pci/bus.c   | 51 ++++++++++++++++++++++++++++++++++++++++++---------\n drivers/pci/iov.c   |  2 +-\n include/linux/pci.h |  3 +++\n 3 files changed, 46 insertions(+), 10 deletions(-)","diff":"diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c\nindex bc56cf19afd3..86daf62c4048 100644\n--- a/drivers/pci/bus.c\n+++ b/drivers/pci/bus.c\n@@ -302,16 +302,9 @@ void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }\n \n void __weak pcibios_bus_add_device(struct pci_dev *pdev) { }\n \n-/**\n- * pci_bus_add_device - start driver for a single device\n- * @dev: device to add\n- *\n- * This adds add sysfs entries and start device drivers\n- */\n-void pci_bus_add_device(struct pci_dev *dev)\n-{\n-\tint retval;\n \n+void pci_bus_add_sysfs_entries(struct pci_dev *dev)\n+{\n \t/*\n \t * Can not put in pci_device_add yet because resources\n \t * are not assigned yet for some devices.\n@@ -321,6 +314,11 @@ void pci_bus_add_device(struct pci_dev *dev)\n \tpci_create_sysfs_dev_files(dev);\n \tpci_proc_attach_device(dev);\n \tpci_bridge_d3_update(dev);\n+}\n+\n+void pci_bus_match_device_driver(struct pci_dev *dev)\n+{\n+\tint retval;\n \n \tdev->match_driver = true;\n \tretval = device_attach(&dev->dev);\n@@ -333,6 +331,41 @@ void pci_bus_add_device(struct pci_dev *dev)\n \n \tdev->is_added = 1;\n }\n+\n+#ifdef CONFIG_PCI_IOV\n+void __weak pci_bus_match_virtfn_driver(struct pci_dev *dev)\n+{\n+\tpci_bus_match_device_driver(dev);\n+}\n+\n+/**\n+ * pci_bus_add_virtfn_device - start driver for a virtual function device\n+ * @dev: device to add\n+ *\n+ * This adds add sysfs entries and start device drivers for\n+ * virtual function devices\n+ *\n+ */\n+void pci_bus_add_virtfn_device(struct pci_dev *pdev)\n+{\n+\tpci_bus_add_sysfs_entries(pdev);\n+\tpci_bus_match_virtfn_driver(pdev);\n+}\n+EXPORT_SYMBOL_GPL(pci_bus_add_virtfn_device);\n+#endif\n+\n+/**\n+ * pci_bus_add_device - start driver for a single device\n+ * @dev: device to add\n+ *\n+ * This adds add sysfs entries and start device drivers\n+ */\n+void pci_bus_add_device(struct pci_dev *dev)\n+{\n+\tpci_bus_add_sysfs_entries(dev);\n+\tpci_bus_match_device_driver(dev);\n+}\n+\n EXPORT_SYMBOL_GPL(pci_bus_add_device);\n \n /**\ndiff --git a/drivers/pci/iov.c b/drivers/pci/iov.c\nindex ac41c8be9200..16cc72545847 100644\n--- a/drivers/pci/iov.c\n+++ b/drivers/pci/iov.c\n@@ -162,7 +162,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id, int reset)\n \n \tpci_device_add(virtfn, virtfn->bus);\n \n-\tpci_bus_add_device(virtfn);\n+\tpci_bus_add_virtfn_device(virtfn);\n \tsprintf(buf, \"virtfn%u\", id);\n \trc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);\n \tif (rc)\ndiff --git a/include/linux/pci.h b/include/linux/pci.h\nindex f68c58a93dd0..39f5c0b4bf23 100644\n--- a/include/linux/pci.h\n+++ b/include/linux/pci.h\n@@ -911,6 +911,9 @@ struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);\n void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);\n unsigned int pci_scan_child_bus(struct pci_bus *bus);\n void pci_bus_add_device(struct pci_dev *dev);\n+#ifdef CONFIG_PCI_IOV\n+void pci_bus_add_virtfn_device(struct pci_dev *dev);\n+#endif\n void pci_read_bridge_bases(struct pci_bus *child);\n struct resource *pci_find_parent_resource(const struct pci_dev *dev,\n \t\t\t\t\t  struct resource *res);\n","prefixes":["v1","1/3"]}