From patchwork Tue Dec 8 20:19:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7802191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 977819F1C2 for ; Tue, 8 Dec 2015 20:22:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE4E52040F for ; Tue, 8 Dec 2015 20:22:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC9A320398 for ; Tue, 8 Dec 2015 20:22:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6Ojp-0001sp-Oe; Tue, 08 Dec 2015 20:19:53 +0000 Received: from mail-by2on0077.outbound.protection.outlook.com ([207.46.100.77] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6Ojf-0001kr-4u for linux-arm-kernel@lists.infradead.org; Tue, 08 Dec 2015 20:19:43 +0000 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 CY1PR12MB0443.namprd12.prod.outlook.com (10.163.91.21) with Microsoft SMTP Server (TLS) id 15.1.337.19; Tue, 8 Dec 2015 20:19:19 +0000 From: Suravee Suthikulpanit To: , , , Subject: [PATCH v4 1/5] acpi: pci: Setup MSI domain for ACPI based pci devices Date: Tue, 8 Dec 2015 12:19:01 -0800 Message-ID: <1449605945-10707-2-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1449605945-10707-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1449605945-10707-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR01CA061.prod.exchangelabs.com (25.160.23.51) To CY1PR12MB0443.namprd12.prod.outlook.com (25.163.91.21) X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0443; 2:URwMJCRvuQI9xnV+ogpH3HBQel6nj9WH7COmQ8M+m2qPkZjS4tfaQPvbApHQ5BF83FKrB8s6Jk9lyCWLyK1jnSPbYQSbKKIdhgi1CesmebKJ9tFuvjv+T+u8Pf/OSGcFDLGoYCNH9QM4C3gu7r0ZgA==; 3:SD/2IzKuZXFNN36Rj5O500PMh9FfTn9r5BmzVCYHCROiLXgxOTM+JevA+fbIZd2LRT9m7t7wuGvgUPeLxEF5I4nGzvmtel3zcQ4kP8M8AnqFKSXaaTTGf7guYkEngndH; 25:Oe0BvYjC5O8la+W9Hj4flXeam/Y/MesKDlW12TCAaFKQlwNAFquxHOIHnaRP+Ux0innU7xfCKoIPGWiONE6wFpWHSULshYfj4oPe2mjNf55VeqwN0cqP8zcNwv+FCRt7aRci60w/q09PAZ2vo7xi071MsMPDbwM/O3IKs0iNE4n+YA1GpeaUjvDB9osthVBc7n653k/V8f+mGvV1kZdu2SIVgWbeF6S966DDBn89kLcJEkaka4xVZ8eVcVYiLF+HDYDuTwZ53Szalxi+CnLejg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0443; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0443; 20:AD4IQ+VGjnC2Wd7N7XEEGkQRRGZVijrPdqGSBhRxZqMKbviLYDBfgupYOeLePMR6yKj9RhC7Rqqr2lICeleDWwKmUmltGC+LDnWWQLSe/Mc6ALTtw941bgLe4uAbQjLVlG1AN6gwmw43BPKjD8wtYgSPFqenOxx+dcOlBboM/gcif1KsvpYwQzimTCCMvVoDCNuAWZeg3o0rwex5A4qQ/3+jaf+BvkOy6TV9feDfGZVLKsVEIeHGZpQR9f0nf9c9GQ8xb+mvOSXrfNIgKVr19rZb1RiqFT/DNJG+kYR+lLOyvL36tKy3PFN+i8qURvEu1EsNk1LmOSnil+KwCHbMc+hRe8Fq0Cisq0hVWTQx7kPTZGGq/XTnZlEQDdvuBU6L0eZuKE+z/ujjtOpZmyeHimdzUz6IvV3Ez3/d4VI+KwSb66eS4qtxgPQEo7JNIVI6q1AnFzRzXKdD9x/iswzh1jTaDRhYuq3wjbWNEjwH9Td3a3uMHuCdHlm9sKLLBXVM; 4:fk2BviiwReNy2Ba6uFvxNMdwAnu1Qn1G7yBcCoamzEoqz5Ip3joWnLTZsPkyZvnhbYFHj8V7KSSvGd/Ru1hDJgJn7FTZrht1xHpOkHLn1r+vNyx9mk5jNtPDjO6SR1bM9dGIkp5Q1bvE6MlHhs7syZKgs+s/6W58IIuOtS0OP2GIlVqBogCWuVUjWyvK6NTn32VCkLK+vepQUuGdnR1/v9sWTWo+nDJl/J4f4rBlIyrHw0TwCMTLbJSr1APrb1qa0cqkZ9FSIqbOg9gKZImOUAVWirBF3XWwOhINhDiUXO6GJJCqCGNzcbY2/60HKjuR0AwsYABWSl893YRT3vQeoRhUEkgydr7U8S/2vCl9ylnUuusmATTEehI0xqy4ILMdRytypp/TH6rifyc6DLF6I3oJspnmNKffi2gqnExoZTU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(3002001)(10201501046); SRVR:CY1PR12MB0443; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0443; X-Forefront-PRVS: 0784C803FD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(189002)(199003)(76176999)(3846002)(6116002)(87976001)(5003940100001)(5008740100001)(48376002)(122386002)(189998001)(77096005)(2950100001)(586003)(5004730100002)(105586002)(229853001)(1096002)(5001770100001)(106356001)(19580405001)(53416004)(36756003)(42186005)(50986999)(50226001)(19580395003)(2201001)(97736004)(86362001)(47776003)(40100003)(50466002)(66066001)(101416001)(92566002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0443; 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; CY1PR12MB0443; 23:zrZ+7hOUbhAqOkj6C9I8X/dV8ShfGLx5Zjg7QApZU?= =?us-ascii?Q?6eAy2LT4KR3f3u8QBWGoI8ILDTo2HsnDikLcMbXeQSeMxVUQetrQ8vvS1P1w?= =?us-ascii?Q?87QyKbhvu7A543mzUDvq1heG/AuFeCXqL8hnfbG9o5AGg6obTreMRXa7qHW3?= =?us-ascii?Q?ec/xJR/pBCz6S9Hpd8CETGSFvc8Pm3B9YidMOxan4RUdCjScbehEqhrp+Kx9?= =?us-ascii?Q?CjhWfTWYhSWTIXfIZIR5lpkdregrV6hJnOx5mpVV+f1y9TGkDT+CNMECoz10?= =?us-ascii?Q?wTbMRpTMuSPAf9AohVHGlM35iVXkUZNB78TT6275Y/YcAUD7B0OUUrOqCwzt?= =?us-ascii?Q?ymhE0MiDnoobJS4WYncg7ASXsoy0iSBiDj39GygMxdRhowjiOZArrQN3s1hU?= =?us-ascii?Q?eFbYphbsfmqjnj0dQAAk2VOM+bkabmRkrKD5xh/TTpBR+W9NOW72+XGNtzir?= =?us-ascii?Q?eaLLKSmS+0qIF4Cp74NQI9WKlR8MeWz/BTQ8wmQHyzQ80+TOtZwJ1oTHI+3O?= =?us-ascii?Q?nGI89Sfp9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m9NdowlOcMZ+1znUoseFBC8lTYSF5QLKSef0vCIQqtRWs0jmRNIg+6XrvPY3Z7RZgVjAdTfawccr3x6YclmrK/tJ+9RskzwQDxWTLFl0rHvC4AwLTaXGbSP5w7fJQ+kHhCXhRmc8Vzw5mfEbg2IzEMEk1dylIYT1sGoxZ4XihZ8Ir3tbqgBxaecUrLjntojVPBq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2015 20:19:19.4194 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151208_121943_233782_61B0769D X-CRM114-Status: GOOD ( 12.27 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , graeme.gregory@linaro.org, Catalin Marinas , dhdang@apm.com, Will Deacon , linux-kernel@vger.kernel.org, tomasz.nowicki@linaro.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, Suravee Suthikulpanit , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces an interface 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/pci.h | 10 ++++++++++ 3 files changed, 44 insertions(+) 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/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) {