From patchwork Wed Dec 9 01:48:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 57916 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp385288lbb; Tue, 8 Dec 2015 17:49:28 -0800 (PST) X-Received: by 10.98.86.92 with SMTP id k89mr9431994pfb.111.1449625767953; Tue, 08 Dec 2015 17:49:27 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d28si8869959pfj.87.2015.12.08.17.49.27; Tue, 08 Dec 2015 17:49:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbbLIBtY (ORCPT + 28 others); Tue, 8 Dec 2015 20:49:24 -0500 Received: from mail-by2on0067.outbound.protection.outlook.com ([207.46.100.67]:12704 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752144AbbLIBsZ (ORCPT ); Tue, 8 Dec 2015 20:48:25 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from ssuthiku-fedora-lt.amd.com (165.204.77.1) by BY1PR12MB0437.namprd12.prod.outlook.com (10.162.147.139) with Microsoft SMTP Server (TLS) id 15.1.337.19; Wed, 9 Dec 2015 01:48:21 +0000 From: Suravee Suthikulpanit To: , , , CC: Lorenzo Pieralisi , Will Deacon , Catalin Marinas , , , , , , , , Suravee Suthikulpanit Subject: [PATCH v5 1/5] acpi: pci: Setup MSI domain for ACPI based pci devices Date: Tue, 8 Dec 2015 17:48:02 -0800 Message-ID: <1449625686-5594-2-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1449625686-5594-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1449625686-5594-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR05CA0068.namprd05.prod.outlook.com (10.141.20.38) To BY1PR12MB0437.namprd12.prod.outlook.com (25.162.147.139) X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0437; 2:wViXxO04p+GQLS/1cFZ+de+rhyb+ao/GgvQ33PYvTsreBF1ZHlnf9ngu0x4jEyLlYdSWZNqi8MVpDcrp4wh/hn7pn8NBgpVnQuUwI9nqRzUQwAVNQW6gxZpLuRe0vNkGAkUsZbDXxvl+CRWY0/sD7g==; 3:EMievusRgMqSabFR0UH/4tEYa4zIUCxRBQYbQyfpIpu5Yg5Vb3vCjzXXJYNsezg4UIL3yR6uGMZGxiQ51rxxqbrXNskfK8jJRJM27EJqTHGJe4OyextIAV9JHyyXzHMr; 25:Gf7HAm+q+t60PBufZeKnehAn3lylFSyZGdaNGAkrFJ9afLYsDJDeKZnrNWMXVwtmr4wzSvTh/PImP5pjl1sQaTA/AR64zMEdgKsbaK/+zByb43+y99CJQlxnNZebYB+JI4bKVhlLdm4OzuQVh8F/U/v1MLNpTPSSMDC7kr2YD3qPA4Yz9axR5pXabsOfpunBddJ+M4y5jb4FezjCSAOLD34NmYtOTAoH1OJUakJyc7eIo76ySI+0veeesBuecK++lmI0vF2Cs450EQ3YhxHhfQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR12MB0437; X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0437; 20:0/D+5pt2OJoBfjsAJgJ7MgNYeky2JzKeiF/ID4qMcngDSEVP2erchn5E2Rb8RndKie+NIS4gHT3k8ZhC+EyQC0hu8pBOjO6K3Vp8VgzZykCuQVzNdCuBXGSaQ+oixlt0aJGUn0bET+w6etxAXG/3kXaJEure4V3sXTMS2GXD/vYw0ca+g68PtIBTVxnR+cohzpHqQGyEtWViS71g6W0UpV40mrqIpmD8piXHtReiFzgCWpB/oOdfWnq/w99PTSLtVZn/viD8a/od3hcGa38tsMW0gAxZBrJgycvPGd4M/C+tQUF6f4pVMM6KxmnJDK/K+PzUhR0FILR/n697VgOZojOrF5vvdiYwOt5UwSJcNuYxWB+uKh8+OQYqsxdGswyf/LDorhTgvTm5qyrF5JkLyu/bK4wFoOez7PrT2kUSTK+sGlSkrAo+wk0NmPWawt7OALITTohoS5I2l51JspTyVjRVp6u8TpGiujfmWQrSnubiVjBQFTp5sAoh4LjqBHCR; 4:5yVrd0Y7g4ifvpuPflYsUc490MzDQPM8RIX/lpNR88A389h17R69mj5sRROVaEflRcvTxaGtMNpNDUqoxOstKTkKRMln6G03n1xKV9KWk1AVRgvMAoMX1gEaYev0ETsovj+ckC+ExHENawh1NbyV3fv87XNOJhyJ16bN47l47Su0p6hLi7LI/88rdNFZF85IDOR06OIkhrbIz2jPeSOCUDTXwevJcN5KgVjbFsH2xR5v6wbbOgai8EnCFq6C4tnH/OaEL6Cwa/xs07QaW9LHsX2763pOzr0tt+WxorAwtXJ5UNuKIc7paLxk5VplE4bMKSINls5vnN5Y0kDgddwVG5gMT6XndJDxAgKwKzBD3N7xmQrKwwpQ5lqonBYrbj2k0uHAj+EZv5FspnzsQraQsJHTCkZRaguI/TZAzGhD/qQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY1PR12MB0437; BCL:0; PCL:0; RULEID:; SRVR:BY1PR12MB0437; X-Forefront-PRVS: 0785459C39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(36756003)(77096005)(2950100001)(86362001)(229853001)(92566002)(101416001)(53416004)(122386002)(97736004)(2201001)(42186005)(87976001)(5001770100001)(19580405001)(5004730100002)(50226001)(48376002)(19580395003)(1096002)(47776003)(189998001)(50986999)(66066001)(5003940100001)(106356001)(5008740100001)(6116002)(50466002)(3846002)(586003)(76176999)(105586002)(40100003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR12MB0437; H:ssuthiku-fedora-lt.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR12MB0437; 23:o+Dmn2R+edmCxtVfA26e6q2U7b2o3e428S289WUmu?= =?us-ascii?Q?U6vDXuusp7GSEHbk/7pTKsrPrQWFy6ykqE0yjbpkyysUVMEoQbYdKDvO0fBr?= =?us-ascii?Q?XpB4VQBnlbywsal27QKyjhSHH8tIQNvvOvonyrHtkq/zyFlLTrkGwobKsty+?= =?us-ascii?Q?0Cs9xyMzv6XxxI3vWU6X6GgeL8+knwczKg5o4L+2q2trWD9hGW6VWdEX/FLo?= =?us-ascii?Q?jzCoEPhuifg9K4svGBzGvEGwe9sWI650uSABqNp0JlhxqsoafIsiX3SDmaQt?= =?us-ascii?Q?YsO3RypcVnsCMoSO4hnZFd0hStsG3YUR2PCUQdYOe/Pt9IlU6c5aL/CyB85K?= =?us-ascii?Q?OZn2mGW6NHc7tz4GQbiTIt0XWq+4zIpuzrBe0cmNGL2baRiKlBU8xi24LT1I?= =?us-ascii?Q?ZldqyI4gFNVS+5l51GBgBVN+hR4rMl8fQIW3NCxVLas9dLd0B0fIBZb8H6Jm?= =?us-ascii?Q?hYyQufM/cr4ZKPFK32ae1A2V6MRi8PPr7cCKD4cV5mi8Oz0JWgQCgWbsrorf?= =?us-ascii?Q?NpNwh80ddqK7sLMOlk2iOUpfMnnJjecw8CyJm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oUGv3v3aoQ5QBSYDajkbZwcU+p+Vm5akG19pnhq9M4pn+4 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2015 01:48:21.1159 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR12MB0437 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces pci_msi_register_fwnode_provider() for irqchip to register a callback, to provide a way to determine appropriate MSI domain for a pci device. It also introduces pci_host_bridge_acpi_msi_domain(), which returns the MSI domain of the specified PCI host bridge with DOMAIN_BUS_PCI_MSI bus token. Then, it is assigned to pci device. Signed-off-by: Suravee Suthikulpanit --- drivers/pci/pci-acpi.c | 32 ++++++++++++++++++++++++++++++++ drivers/pci/probe.c | 2 ++ include/linux/irqdomain.h | 5 +++++ include/linux/pci.h | 10 ++++++++++ 4 files changed, 49 insertions(+) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index a32ba75..a555d7e 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -9,7 +9,9 @@ #include #include +#include #include +#include #include #include #include @@ -689,6 +691,36 @@ static struct acpi_bus_type acpi_pci_bus = { .cleanup = pci_acpi_cleanup, }; + +static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev); + +/** + * pci_msi_register_fwnode_provider - Register callback to retrieve fwnode + * @fn: The interrupt domain to retrieve + * + * This should be called by irqchip driver, which is the parent of + * the MSI domain to provide callback interface to query fwnode. + */ +void +pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *)) +{ + pci_msi_get_fwnode_cb = fn; +} + +struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) +{ + struct irq_domain *dom = NULL; + struct fwnode_handle *fwnode = NULL; + + if (pci_msi_get_fwnode_cb) + fwnode = pci_msi_get_fwnode_cb(&bus->dev); + + if (fwnode) + dom = irq_find_matching_fwnode(fwnode, + DOMAIN_BUS_PCI_MSI); + return dom; +} + static int __init acpi_pci_init(void) { int ret; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index edb1984..553a029 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -672,6 +672,8 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) * should be called from here. */ d = pci_host_bridge_of_msi_domain(bus); + if (!d) + d = pci_host_bridge_acpi_msi_domain(bus); return d; } diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index d5e5c5b..a06feda 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -410,6 +410,11 @@ static inline bool irq_domain_is_hierarchy(struct irq_domain *domain) static inline void irq_dispose_mapping(unsigned int virq) { } static inline void irq_domain_activate_irq(struct irq_data *data) { } static inline void irq_domain_deactivate_irq(struct irq_data *data) { } +static inline struct irq_domain *irq_find_matching_fwnode( + struct fwnode_handle *fwnode, enum irq_domain_bus_token bus_token) +{ + return NULL; +} #endif /* !CONFIG_IRQ_DOMAIN */ #endif /* _LINUX_IRQDOMAIN_H */ diff --git a/include/linux/pci.h b/include/linux/pci.h index 6ae25aa..d86378c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1946,6 +1946,16 @@ static inline struct irq_domain * pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } #endif /* CONFIG_OF */ +#ifdef CONFIG_ACPI +struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus); + +void +pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *)); +#else +static inline struct irq_domain * +pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; } +#endif + #ifdef CONFIG_EEH static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev) {