Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752100AbbGMJPu (ORCPT ); Mon, 13 Jul 2015 05:15:50 -0400 Received: from mail-bn1on0117.outbound.protection.outlook.com ([157.56.110.117]:52688 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752038AbbGMJPq (ORCPT ); Mon, 13 Jul 2015 05:15:46 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NRF5Q3-08-RW2-02 X-M-MSG: From: Suravee Suthikulpanit To: , , , , CC: , , , , , , , , , , , Suravee Suthikulpanit Subject: [RFCv2 PATCH 8/8] pci: acpi: Bind GICv2m MSI frame to PCI host bridge Date: Mon, 13 Jul 2015 16:14:24 +0700 Message-ID: <1436778864-17645-9-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1436778864-17645-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1436778864-17645-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD002;1:dtYfH663nO6h5HnbFWnHyovDaghWacPYjivOIaobHMwuXLVu+6VXcBUo7E6TDzilYpzxutlTJtbBq9ZXtV5j8NN9ii5Y4bZrU10xY5jiuKHcUHxCoozxvhOq3PbFe8i+H52mMu0+VOdv47ZmyvsY9oM9b0V3uWKiFKAGPrJSOvG0X4Wq9QRw/2IIhja+O/IbfGMdwd51W4P8JZTIhvaIrvqIriOEIOYhPOddl/hjPQwiB16Vn0WPsoRBBozOskxLAWWpx0aRaH03YOxaTnBOrbn7e8afXa+xtYqt1z1x6J3nEy8b2o+h0eoYJdtWYnWV4ykWDOXv8N4K+7kleXbKuZqlPm6N6kI9LUxZ0+a1jlN+QrVzNOgLXS2jJgXTBTsv9iH8Zw4uqBcV8UvZkfxLLCd7fog49EDXMKwIKZAh47Y= X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(428002)(199003)(189002)(105586002)(47776003)(53416004)(229853001)(5003940100001)(5001770100001)(5003600100002)(36756003)(62966003)(189998001)(77156002)(15975445007)(86362001)(2201001)(19580395003)(77096005)(19580405001)(46102003)(50226001)(87936001)(2950100001)(92566002)(101416001)(50466002)(48376002)(50986999)(76176999);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB1138;H:atltwp02.amd.com;FPR:;SPF:None;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB1138;2:ltxNRWUTZC//ZB1VBBSyRNA+TAwslzp1N+Ea3YyA5sSuh6qNXXJntvFBwhJFSvt8;3:uelKkEAdf19ZcZp3mQ4mn0+pkEK6t4o81/uLEHnPXcDl4cdbsuEfo2XwKEZrksvQQhubSWDABSSx7MxbhIgETQ6U1mFaKM/uIaH+9TgUbJm8QAK1AO2KgSxu7rRrv2j7oe3C0HHKINEWEOxU5gkglfsg2zeHZifCXx4VyScG0NxoP6sD6tmlc7lWe3gRjmIjBj4RFLqOr+Jr0k9Ifj09qzStpdPd5fSOQXvGSuU63L479GVboEjqH/5i7a735rIn;25:pPE7dxKCMXOhIXBQYz+mklvMKpwxWpvZan7CQfGF6I6wVeknrAiwCOw8D0nAYBoRU8RopeE6dYkxAoXnS++rInX1xmNBVnXYL/Va7/rSz23ub8e8c/7HLR4cLRaWoWG7IJWnTMRufj/Z8PfpiXkZ5jFwkpDZD0Ch72EJ1U/LMrLhbSFml5rl+8ICBvkgRAb+Zi5DXx2bRVN9l2f5IFECglNreEU4Go0xHoWJEkFX+Jprt9MXA3YzjC0wj3wntmpOjicyMTlpBFy+SRrfl0FEzQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB1138; X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB1138;20:MkHdk5VGA6A9EN4Lu9vdKuKMq0moXy8h5mjTssBTBx9k2Oec8rBpMVqvX1A5ea5OF9rDj//6ud7ndn5oiS3tuyUHXA2mi86ZKqoYE+KZ0r7TzwzvFTTrTWnlyveRvbug6jpnNISlupEOWMdukYNpR+AkKno0piw73VQYQsP9LHZJhrS6s/MfT4rGT/V8cH2P41KX8a1gKuw1PW9tLqyqbmA1JLdYNBudrfe6i01eTOtni/wO+co9ZvSj97rBGjoi10JZi9rYVo+5gB+4s+9nOL0acxB2MuP+V1T8mUr7tKP2Hp4naNDS3MsO5MzLGaPto3rJCDv1wXVDxvem1W71A2JGQm2ehutMGYv/DGaqkDbnPMxAafVrlv8Rx885xTY9l/szp3cUh8DTB1AfxVxFvTds6wwWisbVckMxy2PgtZ28R8m2rD9r8dU2rpMo7MzDGH1nl6Elbhb5Gh+I93Ffk54FVfQpgwvBdv068/0x1Hr3k8o2gTp9/zatgNGvRv5v;4:BX0ufmaus0GT5zPN3ir62hmkRu9Ouoxg4TWRtDEaXOfYx6BBJbb16WPTgw42PJxbDOl7Ym2Fpxc51Oa8csLFgnUUbeWHlp8wSPkZpfPEyKb9IQAR18xt6soZr5F10jSMo1GCeqiSABkb9SZziZdAlCEfHrXwwbU9u48h8h+oSQuT4cAKrNeBsrHe2Xc8TdQ2m4gvluxYmIwrHbOXwnlA9tA4q76DChCuwQfMlSiHklM5kMglSDiZi573lPBE2YgNs1zZS3AIwdiU+WgEDuHO9vxMPVWVl6XBts8z80/4IYs= BLUPR02MB1138: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BLUPR02MB1138;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB1138; X-Forefront-PRVS: 0636271852 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2zDYSsKYTuKS5N3OdpIo+QjpixV3nHNS7eHfWlxBWpRwgGlxRK+lWfzQ==;24:kn/yCTqzSLQ2jBSTylNSYJYjlGS9vZtykMi/f7cbVhFp/e2z+JnV2dG10iwS0wfthlsl1Skri8esIse8gVsrlBDpR2RUQgR1nKOVZknpmeM=;20:4b9cRAFbF/XkrOQXWCDMa7ld21nl+JW9/ML/Z6KUaCUYOhXFbExYk8rts6hcjMI4XY2Nu9u+wbKbRDhrO2++HQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2015 09:15:43.0620 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB1138 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3349 Lines: 111 This patch introduces pci_set_phb_acpi_msi_domain(), which looks for GIC MSI frame and bind the corresponded GICv2m irq_domain to the PCI host-bridge. Signed-off-by: Suravee Suthikulpanit --- drivers/pci/pci-acpi.c | 35 +++++++++++++++++++++++++++++++++++ drivers/pci/probe.c | 2 ++ include/linux/pci-acpi.h | 1 + 3 files changed, 38 insertions(+) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 314a625..0da6b90 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -18,6 +19,10 @@ #include #include "pci.h" +#ifdef CONFIG_ARM_GIC_ACPI +#include +#endif + /* * The UUID is defined in the PCI Firmware Specification available here: * https://www.pcisig.com/members/downloads/pcifw_r3_1_13Dec10.pdf @@ -681,6 +686,36 @@ static bool pci_acpi_bus_match(struct device *dev) return dev_is_pci(dev); } +#ifdef CONFIG_PCI_MSI +void pci_set_phb_acpi_msi_domain(struct pci_bus *bus) +{ + int err; + struct irq_domain *d; + struct acpi_madt_generic_msi_frame *msi_frame; + + /** + * Since ACPI 5.1 currently does not define + * a way to associate MSI frame ID to a device, + * we can only support single MSI frame (index 0) + * at the moment. + */ + err = acpi_get_msi_frame(0, &msi_frame); + if (err) + return; + +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN + d = irq_find_matching_host((struct device_node *)msi_frame, + DOMAIN_BUS_PCI_MSI); + if (!d) { + pr_debug("Fail to find domain for MSI\n"); + return; + } + + dev_set_msi_domain(&bus->dev, d); +#endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */ +} +#endif /* CONFIG_PCI_MSI */ + static struct acpi_bus_type acpi_pci_bus = { .name = "PCI", .match = pci_acpi_bus_match, diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f305b78..c93474f 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -683,6 +684,7 @@ static void pci_set_bus_speed(struct pci_bus *bus) void __weak pcibios_set_host_bridge_msi_domain(struct pci_bus *bus) { pci_set_phb_of_msi_domain(bus); + pci_set_phb_acpi_msi_domain(bus); } static void pci_set_bus_msi_domain(struct pci_bus *bus) diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index a76cb6f..96a19c7 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -99,6 +99,7 @@ static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { } static inline void acpiphp_remove_slots(struct pci_bus *bus) { } static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } #endif +void pci_set_phb_acpi_msi_domain(struct pci_bus *bus); extern const u8 pci_acpi_dsm_uuid[]; #define DEVICE_LABEL_DSM 0x07 -- 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/