From patchwork Tue Jan 19 13:11:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8061771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1F982BEEED for ; Tue, 19 Jan 2016 13:14:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C52E20397 for ; Tue, 19 Jan 2016 13:14:57 +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 BF5D82039C for ; Tue, 19 Jan 2016 13:14:55 +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 1aLW6D-0004k6-PI; Tue, 19 Jan 2016 13:13:29 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aLW4i-0003P9-QJ for linux-arm-kernel@lists.infradead.org; Tue, 19 Jan 2016 13:11:58 +0000 Received: by mail-wm0-x236.google.com with SMTP id n5so111243667wmn.0 for ; Tue, 19 Jan 2016 05:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V5QouKC+Ch2rJGIjJz/jbodTSTeBRJugYmwW4IZlbs0=; b=X1/U1zBkJwN5bAw/NVA+n3lqjnDsQQRcnh+IyWXxmqUpF7YncVSfekD1OxxvQADlym sgndOBBgxIlnsh5Fo3Zywp6k/U/Gx67qNPTdR/u6Ktz6XCahfZIWgvPQwbe8kK/4lf+F C/Hw1Bzj7NoVwUWZS6kcgRa3+bHcv+uVtBY31a7L4mU656mqCcE9sjdHZcmkpJTDF4Ct Ckij1dSQkT8yohkQQDmkmcJ8p26tVPvMmMY/i3aZYgOlCfnUxlKB6qaEI8e2M3e4YkrI bzsmR49XnEE6AgbySi6qtUE9AWfbrF53WfVOM/ChsaN0hPEir9D/jbVb0ugKDBy1s45u fDrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V5QouKC+Ch2rJGIjJz/jbodTSTeBRJugYmwW4IZlbs0=; b=YvgYCrW2VNzFzPqIOD2KuqetmmOLtpDNlmqMR1tx1/L+HcJ/2EO1zzIp2tAk41zugF er9dBhZmlkG5tF+pOBSqjx8Wg6Qtz8diyKYIDOlH20O5hT1iCF6736/0aM4LlbTbj8Bs VVcEKxDOcntWOCBbAHN9KgZemM7r6fzrGPqdVNmVQHwuVsiv4wn3JsbU1Y6Z7bk5OAjt Kr5FLS/bqPPyX7EC28kjXSpURgGDE3DCMC+wYmR6q8u88TA5EysuPYYwjuyH7+kLBFw3 bE/hkFX/ePhTUlGkxD5Nr/AE6vKT7+nnEhaQTLXkqO+Gh2fzR2RX8NiTF5hvY8a4zQTw XS+w== X-Gm-Message-State: ALoCoQmH6LKPVZd9N6ypheeAv85nhco8AEvFoc+3rh+3KhvcukFttsGzpZEzqfAT+ewtiWDqcOI3ZDxaKGJtFWxfT/CEg5QF4w== X-Received: by 10.194.111.232 with SMTP id il8mr34927659wjb.150.1453209100278; Tue, 19 Jan 2016 05:11:40 -0800 (PST) Received: from tn-HP-4.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id w194sm17762623wmd.0.2016.01.19.05.11.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 05:11:39 -0800 (PST) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, lorenzo.pieralisi@arm.com, robert.richter@caviumnetworks.com, shijie.huang@arm.com, guohanjun@huawei.com, Suravee.Suthikulpanit@amd.com Subject: [PATCH V3 10/10] acpi, gicv3, its: Use MADT ITS subtable to do PCI/MSI domain initialization. Date: Tue, 19 Jan 2016 14:11:23 +0100 Message-Id: <1453209083-3358-11-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453209083-3358-1-git-send-email-tn@semihalf.com> References: <1453209083-3358-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160119_051157_219224_C818F522 X-CRM114-Status: GOOD ( 15.67 ) X-Spam-Score: -2.6 (--) 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: graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, ddaney.cavm@gmail.com, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 After refactoring DT code, we let ACPI to build ITS PCI MSI domain and do requester ID to device ID translation using IORT table. We have now full PCI MSI domain stack, thus we can enable ITS initialization from GICv3 core driver for ACPI scenario. Signed-off-by: Tomasz Nowicki --- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 44 +++++++++++++++++++++++++++++++- drivers/irqchip/irq-gic-v3.c | 3 +-- drivers/pci/msi.c | 3 +++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c index 06165cb..7f0a958 100644 --- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +#include +#include #include #include #include @@ -143,10 +145,50 @@ static int __init its_pci_of_msi_init(void) return 0; } +#ifdef CONFIG_ACPI + +static int __init +its_pci_msi_parse_madt(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_madt_generic_translator *its_entry; + struct fwnode_handle *domain_handle; + + its_entry = (struct acpi_madt_generic_translator *)header; + domain_handle = iort_find_its_domain_token(its_entry->translation_id); + if (!domain_handle) { + pr_err("ITS@0x%lx: Unable to locate ITS domain handle\n", + (long)its_entry->base_address); + return 0; + } + + if (its_pci_msi_init_one(domain_handle)) + return 0; + + pci_msi_register_fwnode_provider(&iort_find_pci_domain_token); + pr_info("PCI/MSI: ITS@0x%lx domain created\n", + (long)its_entry->base_address); + return 0; +} + +static int __init its_pci_acpi_msi_init(void) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + its_pci_msi_parse_madt, 0); + return 0; +} +#else +inline static int __init its_pci_acpi_msi_init(void) +{ + return 0; +} +#endif + static int __init its_pci_msi_init(void) { its_pci_of_msi_init(); + its_pci_acpi_msi_init(); + return 0; } - early_initcall(its_pci_msi_init); diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 995b7251..fee635e 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -871,8 +871,7 @@ static int __init gic_init_bases(void __iomem *dist_base, set_handle_irq(gic_handle_irq); - if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis() && - to_of_node(handle)) /* Temp hack to prevent ITS init for ACPI */ + if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis()) its_init(handle, &gic_data.rdists, gic_data.domain); gic_smp_init(); diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7eaa4c8..6ced37b 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1366,6 +1367,8 @@ u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev) of_node = irq_domain_get_of_node(domain); if (of_node) rid = of_msi_map_rid(&pdev->dev, of_node, rid); + else + iort_find_pci_id(pdev, rid, &rid); return rid; }