From patchwork Tue May 31 11:19:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9144387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F994607D6 for ; Tue, 31 May 2016 11:22:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72C7927D17 for ; Tue, 31 May 2016 11:22:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6763227E72; Tue, 31 May 2016 11:22:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 242F8281B4 for ; Tue, 31 May 2016 11:22:15 +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 1b7hj1-0000kz-Mz; Tue, 31 May 2016 11:20:43 +0000 Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b7hih-000803-SS for linux-arm-kernel@lists.infradead.org; Tue, 31 May 2016 11:20:24 +0000 Received: by mail-lf0-x22d.google.com with SMTP id s64so64062111lfe.0 for ; Tue, 31 May 2016 04:20:03 -0700 (PDT) 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=hN7DJEJMnSuyGgTbWdXY263t/0GddwH3oh+gC56DEXY=; b=JhibFHmNDcRAZhi/hJ2n/5qw7PLZ1jBAgXZ54oFesaFr9z5SjUkSSX7Y6j/7a+AC6b B1PzXrO7tCdukDSMA+zzacUmptq3Tpf75FHRnez6aqRlT7JMpKyr73mrtiN2oxQlmbFf 6q61mvrHKbVslbpbXGM4wodCR0l69oYTP6HK4/LWrwD2jvD6/MS8QdkD7txC1JZmlsY3 W4T68g6K8GyZDV4zNY9IrvnBxdwTjiq8+CPWYiItz5/URQh+7ihM+trIUwauXiO9CZJS FCvZECpw/lcBlUEMn7s1KkQ64BmEX1Tq8vmhKQrn2kaAksX5ABJ7y4bgUnU964mkrH/4 6LhA== 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=hN7DJEJMnSuyGgTbWdXY263t/0GddwH3oh+gC56DEXY=; b=EwwHWj087dI5iMoXfXTtF/G6oPzPPqbWM5KTKrC7X2Vw9g5SufI3bZXZLpDKUZbQRT IS1usrz7y4Xxz4IiC+l3Xad4RIKsYgf+6H9TCTfv06VuepDZKNK3MZxHlThKk47TxsL7 blhVaWVfVj3T3G/Pmu7rUw7UBGJanqtiOy+2NnWBJh0+10LX6mv/67nyKKHEu3W7Qw5b xg9E1kihZQwyBsK1m3PaDDU7faJMtHozYPKOn5TGI59olHwYAwb63zGgdd7drsRYtX+f /JWQm+9/qe84MUGOC92CKtSzNmmTcEIISotyHayh3rEeCuzz5EJLjDmyghXg+xI5j8Yi t35A== X-Gm-Message-State: ALyK8tLWEY1X71ZfhNftkGfTKOAjH+mac3CyPvTBb6MH0I73pOYmPgHixDdN6zMVKLjR3A== X-Received: by 10.25.126.5 with SMTP id z5mr10505632lfc.199.1464693601923; Tue, 31 May 2016 04:20:01 -0700 (PDT) Received: from tn-HP-4.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id 66sm5280056lfz.14.2016.05.31.04.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 May 2016 04:20:01 -0700 (PDT) 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, Suravee.Suthikulpanit@amd.com, hanjun.guo@linaro.org Subject: [PATCH V5 2/7] acpi, pci: Setup MSI domain on a per-devices basis. Date: Tue, 31 May 2016 13:19:39 +0200 Message-Id: <1464693584-22343-3-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464693584-22343-1-git-send-email-tn@semihalf.com> References: <1464693584-22343-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160531_042024_157066_04856057 X-CRM114-Status: GOOD ( 12.72 ) 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: al.stone@linaro.org, graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, okaya@codeaurora.org, linux-acpi@vger.kernel.org, ddaney.cavm@gmail.com, Tomasz Nowicki , mw@semihalf.com, andrea.gallo@linaro.org, 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-Virus-Scanned: ClamAV using ClamSMTP It is possible to provide information about which MSI controller to use on a per-device basis for DT. This patch supply this with ACPI support. Currently, IORT is the only one ACPI table which can provide such mapping. In order to plug IORT into MSI infrastructure we are adding ACPI equivalents for finding PCI device domain and its RID translation (pci_msi_domain_get_msi_rid and pci_msi_domain_get_msi_rid calls). Signed-off-by: Tomasz Nowicki --- drivers/pci/msi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index a080f44..ba49df7 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1364,8 +1365,8 @@ u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev) pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); of_node = irq_domain_get_of_node(domain); - if (of_node) - rid = of_msi_map_rid(&pdev->dev, of_node, rid); + rid = of_node ? of_msi_map_rid(&pdev->dev, of_node, rid) : + iort_pci_get_msi_rid(pdev, rid); return rid; } @@ -1381,9 +1382,13 @@ u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev) */ struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev) { + struct irq_domain *dom; u32 rid = 0; pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); - return of_msi_map_get_device_domain(&pdev->dev, rid); + dom = of_msi_map_get_device_domain(&pdev->dev, rid); + if (!dom) + dom = iort_pci_get_domain(pdev, rid); + return dom; } #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */