From patchwork Mon Jun 13 14:41:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9173257 X-Patchwork-Delegate: bhelgaas@google.com 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 1F1AF60573 for ; Mon, 13 Jun 2016 14:43:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11B352040D for ; Mon, 13 Jun 2016 14:43:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0639627AC2; Mon, 13 Jun 2016 14:43:14 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 837702040D for ; Mon, 13 Jun 2016 14:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424305AbcFMOl6 (ORCPT ); Mon, 13 Jun 2016 10:41:58 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:34486 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424299AbcFMOly (ORCPT ); Mon, 13 Jun 2016 10:41:54 -0400 Received: by mail-lf0-f47.google.com with SMTP id j7so62099136lfg.1 for ; Mon, 13 Jun 2016 07:41:52 -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=uE3cCCoMseq0+iPiCiH7QlKM17ragJr7gaJVQoeA+q8=; b=qe6nnmjkieHc6M94LadUKi0AKoCDQbhh2lb0toRASFKXD9q8akvpPdPg9SretAaN+o oAOIGBqjwEJcPOs7xbF52JOKhzsPctSJDZoRe2J1aP9ofO6xPnYhZHzbRAe5QS5ywsBI pHmpJJ6tRbWa2TuSWB5UQGSyf4NRC+p2jiBvSH2HOgypJTuUWgYrMpE9byK1qpdIeKuX +8iU94hw7FYORnLhmpTIBJzO0BjKQzkANeIfMnFdhsJQ9UnsZOVFUHRBC0s492yYWRAF 9bMxr3PdSVx6y/oO6bCG2u+UHWx+Kc+khxl7v6p06z0AJ345hAuj+TLXpAIdVS739Na0 QB+w== 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=uE3cCCoMseq0+iPiCiH7QlKM17ragJr7gaJVQoeA+q8=; b=bleX0FR1NNJv27AMpGgwosG5nZgS3XDByvm8F9PDs24KxaBb/xdh1FsuFegsGHwDQC tausLgji9z345yXroW0PzM/mfbXmgBdTtL4R0ktISNCsFUMw8iEJSCmJ511asTH2OlOH z5brd3mkwQReMcMiRR+vM9SY6ChFs1HLrI0TY2Z+9tRU/7rofK5LaigYss1Ay0OpsHh4 vddAWAlpgHscUepmpA/i5Ki6lKDemvzW8Zux46xmpw1r28tFyji8NRVHi62g47E70F8r OMxnO34rJoRKsAUdnZ9xmSh3uA/hI21hISBZ1dU/sF/6GkITto7+Ru23Bvqu43TuWOyy Gpsg== X-Gm-Message-State: ALyK8tJlVIo3RXWdfC46raUiflBBTFEJw947sQAUYpoZgPiJ/rhIQWj3yjP2SCJgVYtQFQ== X-Received: by 10.25.156.83 with SMTP id f80mr415090lfe.141.1465828906940; Mon, 13 Jun 2016 07:41:46 -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 l79sm394242lfi.40.2016.06.13.07.41.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 07:41:46 -0700 (PDT) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, bhelgaas@google.com, lorenzo.pieralisi@arm.com, robert.richter@caviumnetworks.com, shijie.huang@arm.com, Suravee.Suthikulpanit@amd.com, hanjun.guo@linaro.org Cc: al.stone@linaro.org, mw@semihalf.com, graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ddaney.cavm@gmail.com, okaya@codeaurora.org, andrea.gallo@linaro.org, linux-pci@vger.kernel.org, Tomasz Nowicki Subject: [PATCH V6 2/7] PCI/MSI: Setup MSI domain on a per-devices basis using IORT ACPI table Date: Mon, 13 Jun 2016 16:41:08 +0200 Message-Id: <1465828873-23498-3-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465828873-23498-1-git-send-email-tn@semihalf.com> References: <1465828873-23498-1-git-send-email-tn@semihalf.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.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 Acked-by: Marc Zyngier --- 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..1d45e81 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_msi_map_rid(&pdev->dev, 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_get_device_domain(&pdev->dev, rid); + return dom; } #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */