Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/818771/?format=api
{ "id": 818771, "url": "http://patchwork.ozlabs.org/api/patches/818771/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/1506448161-30961-3-git-send-email-kdinh@apm.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": "<1506448161-30961-3-git-send-email-kdinh@apm.com>", "list_archive_url": null, "date": "2017-09-26T17:49:21", "name": "[v4,pci,2/2] PCI/MSI: Enforce MSI driver loaded before PCIe in ACPI boot", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "0386e9be7c3bf7378e1ae44f7991e25ca80112c7", "submitter": { "id": 71514, "url": "http://patchwork.ozlabs.org/api/people/71514/?format=api", "name": "Khuong Dinh", "email": "kdinh@apm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/1506448161-30961-3-git-send-email-kdinh@apm.com/mbox/", "series": [ { "id": 5205, "url": "http://patchwork.ozlabs.org/api/series/5205/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=5205", "date": "2017-09-26T17:49:19", "name": "PCI/MSI: pci-xgene-msi: Enable MSI support in ACPI boot for X-Gene v1", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/5205/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/818771/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/818771/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>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1pwT48vxz9t49\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 04:13:13 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1031150AbdIZSMz (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 26 Sep 2017 14:12:55 -0400", "from [198.137.200.161] ([198.137.200.161]:58415 \"EHLO\n\tdenmail01.amcc.com\" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org\n\twith ESMTP id S1030942AbdIZSM2 (ORCPT\n\t<rfc822; linux-pci@vger.kernel.org>); Tue, 26 Sep 2017 14:12:28 -0400", "from apm.com (denlwv018.amcc.com [10.88.160.121])\n\tby denmail01.amcc.com (8.13.8/8.13.8) with ESMTP id v8QHne6J002001;\n\tTue, 26 Sep 2017 11:49:40 -0600", "(from kdinh@localhost)\n\tby apm.com (8.14.4/8.14.4/Submit) id v8QHneaI031012;\n\tTue, 26 Sep 2017 11:49:40 -0600" ], "From": "Khuong Dinh <kdinh@apm.com>", "To": "lorenzo.pieralisi@arm.com, marc.zyngier@arm.com,\n\tmsalter@redhat.com, bhelgaas@google.com, linux-pci@vger.kernel.org,\n\tjcm@redhat.com", "Cc": "patches@apm.com, linux-kernel@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org, rjw@rjwysocki.net,\n\tKhuong Dinh <kdinh@apm.com>", "Subject": "[PATCH v4 pci 2/2] PCI/MSI: Enforce MSI driver loaded before PCIe\n\tin ACPI boot", "Date": "Tue, 26 Sep 2017 11:49:21 -0600", "Message-Id": "<1506448161-30961-3-git-send-email-kdinh@apm.com>", "X-Mailer": "git-send-email 1.7.1", "In-Reply-To": "<1506448161-30961-1-git-send-email-kdinh@apm.com>", "References": "<1506448161-30961-1-git-send-email-kdinh@apm.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": "This patch enforces MSI driver loaded before PCIe controller driver\nin ACPI boot mode.\n\nSigned-off-by: Khuong Dinh <kdinh@apm.com>\n---\n drivers/acpi/Makefile | 2 +-\n drivers/acpi/acpi_msi.c | 86 ++++++++++++++++++++++++++++++++++++++\n drivers/acpi/acpi_platform.c | 3 +-\n drivers/acpi/internal.h | 1 +\n drivers/acpi/scan.c | 1 +\n drivers/pci/host/pci-xgene-msi.c | 22 +++++++++-\n include/linux/acpi_msi.h | 37 ++++++++++++++++\n 7 files changed, 148 insertions(+), 4 deletions(-)\n create mode 100644 drivers/acpi/acpi_msi.c\n create mode 100644 include/linux/acpi_msi.h", "diff": "diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile\nindex 90265ab..b33247e 100644\n--- a/drivers/acpi/Makefile\n+++ b/drivers/acpi/Makefile\n@@ -40,7 +40,7 @@ acpi-y\t\t\t\t+= ec.o\n acpi-$(CONFIG_ACPI_DOCK)\t+= dock.o\n acpi-y\t\t\t\t+= pci_root.o pci_link.o pci_irq.o\n obj-$(CONFIG_ACPI_MCFG)\t\t+= pci_mcfg.o\n-acpi-y\t\t\t\t+= acpi_lpss.o acpi_apd.o\n+acpi-y\t\t\t\t+= acpi_lpss.o acpi_apd.o acpi_msi.o\n acpi-y\t\t\t\t+= acpi_platform.o\n acpi-y\t\t\t\t+= acpi_pnp.o\n acpi-$(CONFIG_ARM_AMBA)\t+= acpi_amba.o\ndiff --git a/drivers/acpi/acpi_msi.c b/drivers/acpi/acpi_msi.c\nnew file mode 100644\nindex 0000000..a254e84\n--- /dev/null\n+++ b/drivers/acpi/acpi_msi.c\n@@ -0,0 +1,86 @@\n+/*\n+ * Enforce MSI driver loaded before PCIe controller driver\n+ *\n+ * Copyright (c) 2017, MACOM Technology Solutions Corporation\n+ * Author: Khuong Dinh <kdinh@apm.com>\n+ *\n+ * This program is free software; you can redistribute it and/or modify it\n+ * under the terms of the GNU General Public License as published by the\n+ * Free Software Foundation; either version 2 of the License, or (at your\n+ * option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ */\n+\n+#include <linux/acpi.h>\n+#include \"internal.h\"\n+#include <linux/acpi_msi.h>\n+\n+struct msi_driver_item {\n+\tstruct list_head msi_drv_list;\n+\tstruct platform_driver *addr;\n+\tunsigned char id[ACPI_ID_LEN];\n+};\n+\n+static LIST_HEAD(msi_drv_list);\n+\n+static acpi_status acpi_create_msi_device(acpi_handle handle, u32 Level,\n+\t\t\t\t\tvoid *context, void **retval)\n+{\n+\tacpi_status status = AE_OK;\n+\tint result;\n+\n+\tacpi_scan_lock_acquire();\n+\tresult = acpi_bus_scan(handle);\n+\tacpi_scan_lock_release();\n+\tif (result) {\n+\t\tstatus = AE_ERROR;\n+\t\tgoto out;\n+\t}\n+\tresult = platform_driver_register((struct platform_driver *) context);\n+\tif (result) {\n+\t\tstatus = AE_ERROR;\n+\t\tgoto out;\n+\t}\n+out:\n+\treturn status;\n+}\n+\n+void __init acpi_msi_init(void)\n+{\n+\tstruct msi_driver_item *current_msi;\n+\tstruct list_head *pos;\n+\n+\tlist_for_each(pos, &msi_drv_list) {\n+\t\tcurrent_msi = list_entry(pos, struct msi_driver_item,\n+\t\t\t\t\tmsi_drv_list);\n+\t\tif (!current_msi)\n+\t\t\treturn;\n+\n+\t\tacpi_get_devices(current_msi->id,\n+\t\t\tacpi_create_msi_device,\n+\t\t\t(void *) current_msi->addr,\n+\t\t\tNULL);\n+\t}\n+}\n+\n+void acpi_msi_drv_subscribe(struct acpi_device_id msi_acpi_ids,\n+\t\t\t\t\tstruct platform_driver *msi)\n+{\n+\tstruct msi_driver_item *new_msi;\n+\n+\tif (!msi)\n+\t\treturn;\n+\n+\tnew_msi = kmalloc(sizeof(*new_msi), GFP_KERNEL);\n+\tif (!new_msi)\n+\t\treturn;\n+\n+\tlist_add(&(new_msi->msi_drv_list), &msi_drv_list);\n+\tnew_msi->addr = msi;\n+\tstrncpy(new_msi->id, msi_acpi_ids.id, sizeof(new_msi->id));\n+\tnew_msi->id[sizeof(new_msi->id) - 1] = '\\0';\n+}\ndiff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c\nindex 88cd949..a546076 100644\n--- a/drivers/acpi/acpi_platform.c\n+++ b/drivers/acpi/acpi_platform.c\n@@ -44,7 +44,8 @@ static void acpi_platform_fill_resource(struct acpi_device *adev,\n \t * If the device has parent we need to take its resources into\n \t * account as well because this device might consume part of those.\n \t */\n-\tparent = acpi_get_first_physical_node(adev->parent);\n+\tparent = adev->parent ?\n+\t\t\tacpi_get_first_physical_node(adev->parent) : NULL;\n \tif (parent && dev_is_pci(parent))\n \t\tdest->parent = pci_find_resource(to_pci_dev(parent), dest);\n }\ndiff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h\nindex 4361c44..ec81801 100644\n--- a/drivers/acpi/internal.h\n+++ b/drivers/acpi/internal.h\n@@ -80,6 +80,7 @@ int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler,\n void acpi_lpss_init(void);\n \n void acpi_apd_init(void);\n+void acpi_msi_init(void);\n \n acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src);\n bool acpi_queue_hotplug_work(struct work_struct *work);\ndiff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c\nindex 602f8ff..f1d7b96 100644\n--- a/drivers/acpi/scan.c\n+++ b/drivers/acpi/scan.c\n@@ -2110,6 +2110,7 @@ int __init acpi_scan_init(void)\n \tacpi_status status;\n \tstruct acpi_table_stao *stao_ptr;\n \n+\tacpi_msi_init();\n \tacpi_pci_root_init();\n \tacpi_pci_link_init();\n \tacpi_processor_init();\ndiff --git a/drivers/pci/host/pci-xgene-msi.c b/drivers/pci/host/pci-xgene-msi.c\nindex d657248..327e663 100644\n--- a/drivers/pci/host/pci-xgene-msi.c\n+++ b/drivers/pci/host/pci-xgene-msi.c\n@@ -26,6 +26,7 @@\n #include <linux/platform_device.h>\n #include <linux/of_pci.h>\n #include <linux/acpi.h>\n+#include <linux/acpi_msi.h>\n \n #define MSI_IR0\t\t\t0x000000\n #define MSI_INT0\t\t0x800000\n@@ -577,8 +578,25 @@ static int xgene_msi_probe(struct platform_device *pdev)\n \t.remove = xgene_msi_remove,\n };\n \n-static int __init xgene_pcie_msi_init(void)\n+static int __init xgene_pcie_msi_subscribe(void)\n {\n+\tint i;\n+\n+\tfor (i = 0; i < sizeof(xgene_msi_acpi_ids)\n+\t\t\t/ sizeof(xgene_msi_acpi_ids[0]) - 1; i++)\n+\t\tacpi_msi_drv_subscribe(xgene_msi_acpi_ids[i],\n+\t\t\t\t\t\t&xgene_msi_driver);\n+\treturn 0;\n+}\n+\n+static int __init xgene_pcie_msi_register(void)\n+{\n+\tif (driver_find(xgene_msi_driver.driver.name, &platform_bus_type))\n+\t\treturn -EBUSY;\n+\n \treturn platform_driver_register(&xgene_msi_driver);\n }\n-subsys_initcall(xgene_pcie_msi_init);\n+\n+pure_initcall(xgene_pcie_msi_subscribe);\n+\n+module_init(xgene_pcie_msi_register);\ndiff --git a/include/linux/acpi_msi.h b/include/linux/acpi_msi.h\nnew file mode 100644\nindex 0000000..f132416\n--- /dev/null\n+++ b/include/linux/acpi_msi.h\n@@ -0,0 +1,37 @@\n+/*\n+ * Enforce MSI driver loaded before PCIe controller driver library\n+ *\n+ * Copyright (c) 2017, MACOM Technology Solutions Corporation\n+ * Author: Khuong Dinh <kdinh@apm.com>\n+ *\n+ * This program is free software; you can redistribute it and/or modify it\n+ * under the terms of the GNU General Public License as published by the\n+ * Free Software Foundation; either version 2 of the License, or (at your\n+ * option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ */\n+\n+#ifndef __ACPI_MSI_H__\n+#define __ACPI_MSI_H__\n+\n+#include <linux/platform_device.h>\n+\n+/**\n+ * acpi_msi_drv_subscribe - Allow MSI drivers to subscribe its driver\n+ * information (acpi device id and platform driver address) such that\n+ * the ACPI driver layer probes its first before the controller\n+ * enumerated. This enforce that the MSI driver is always probed\n+ * before the PCIe controller driver.\n+ *\n+ * @msi_acpi_ids: The MSI ACPI devive.\n+ * @msi: The MSI platform driver.\n+ *\n+ */\n+void acpi_msi_drv_subscribe(struct acpi_device_id msi_acpi_ids,\n+\t\t\t\t\tstruct platform_driver *msi);\n+\n+#endif\t\t\t\t/* __ACPI_MSI_H__ */\n", "prefixes": [ "v4", "pci", "2/2" ] }