From patchwork Thu Aug 11 10:06:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9274955 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 21F3460231 for ; Thu, 11 Aug 2016 10:09:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11B1B285E4 for ; Thu, 11 Aug 2016 10:09:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06227285E9; Thu, 11 Aug 2016 10:09:18 +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=unavailable 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 B61BB285E4 for ; Thu, 11 Aug 2016 10:09:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bXmu0-00048g-Gb; Thu, 11 Aug 2016 10:07:52 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bXmtL-0003ln-Vt for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2016 10:07:14 +0000 Received: by mail-wm0-x229.google.com with SMTP id i5so4988836wmg.0 for ; Thu, 11 Aug 2016 03:06:51 -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=YnNEcUPbyjkF7tPZS6bqYJbRlNWbKrcLQmWKNHBXtbU=; b=jmH2SZ0qpwhN10KlWHDed+OohqvGvfQP7qpOhoI/4gN9mIUA6s4hjLm2XcwfBkNbq9 f0DSO+kkHaY4beqM1AyaIAb2jPLicXuH+jCr7BIwJIfR+VeUnXSlvgRgntUff6kcGaml zo8hiXVMlbJ5EgmcBjLv/1Fb5mXzm/IL1R0HXZjBrP1URy7oW+kpSyD0eY2xFOxb7QR7 gSuibOcJ2QefZ3j8WxYxJKazD1Vilq/d1qEMv+KM8BVpSQROgSTZfjkr3Fjoz/DUnrJ1 sXzXpN9JKlTmAzGfYuugj7I0qo+Vn8/T+AdJGfZMLTXf3TMWy3HW9KKVK6Xh61UaWbfR pAAw== 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=YnNEcUPbyjkF7tPZS6bqYJbRlNWbKrcLQmWKNHBXtbU=; b=DLWsZ9JtY5Hkfoxb1MU/7gAki7x4RwMS4RAixrqRqwoSD0KRzQkNZviLX1Tdmbj6WA DbivKzsDh4dXy9WENk+o4MIqJhZzgeYFmCiZSOhlH07EVLRq+mOo0KxRL5pPrxeOHk9u xjPHIjPhi37Za+iHPcI7p9/f0MyLdJizi1UDtUGYK2IZ+EfjK2S4/gLvRIWEKEAc1Evk AMO3qNiRQzfC550+/CT9P3PJaYAlTvWa/YQuKSQPUD7SCQ1YyU95AW9vVZXt3l9NDi5L J9owVQwu2QfsPUvjev90TePhIUr/Ub6jyIAwxeoLlr9Ogj9SZPOXybTMy2NGe5sYZeNL t5+A== X-Gm-Message-State: AEkoouu2LWPFb8YHcMcP2Wb5fHUBwmxSgNCWUTk4TYS2BeF6hajJGEr3nKSTBaY1xGtfmg== X-Received: by 10.25.210.75 with SMTP id j72mr1373205lfg.4.1470910009817; Thu, 11 Aug 2016 03:06:49 -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 p21sm448233lfp.4.2016.08.11.03.06.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 03:06:48 -0700 (PDT) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, helgaas@kernel.org, rafael@kernel.org, Lorenzo.Pieralisi@arm.com Subject: [PATCH V8 3/8] PCI/MSI: Setup MSI domain on a per-device basis using IORT ACPI table Date: Thu, 11 Aug 2016 12:06:33 +0200 Message-Id: <1470909998-16710-4-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470909998-16710-1-git-send-email-tn@semihalf.com> References: <1470909998-16710-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160811_030712_423429_62A2D697 X-CRM114-Status: GOOD ( 11.74 ) 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, al.stone@linaro.org, linaro-acpi@lists.linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, okaya@codeaurora.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, hanjun.guo@linaro.org, ddaney.cavm@gmail.com, linux-pci@vger.kernel.org, shijie.huang@arm.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 Reviewed-by: Hanjun Guo Acked-by: Marc Zyngier Acked-by: Bjorn Helgaas --- 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 a02981e..7bb981a 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1498,8 +1499,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_msi_map_rid(&pdev->dev, rid); return rid; } @@ -1515,9 +1516,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_get_device_domain(&pdev->dev, rid); + return dom; } #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */