From patchwork Mon Sep 12 18:32:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9327515 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 CF15760231 for ; Mon, 12 Sep 2016 18:34:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C858F28E1D for ; Mon, 12 Sep 2016 18:34:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCDAC28E3A; Mon, 12 Sep 2016 18:34:46 +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 40A2228E1D for ; Mon, 12 Sep 2016 18:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755612AbcILSdR (ORCPT ); Mon, 12 Sep 2016 14:33:17 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:33765 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755510AbcILSdN (ORCPT ); Mon, 12 Sep 2016 14:33:13 -0400 Received: by mail-lf0-f42.google.com with SMTP id h127so94254400lfh.0 for ; Mon, 12 Sep 2016 11:33:13 -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=PWsfNMN5PkaAHxS3BXQS/eBEFhHeKuE4fTldXRDNVXo=; b=aS+iDQ6TAFCP4HBe7JczZiVXmm4Vd6kDrgKP2T3aOPbCyW/sz4s2aOKBF/N1VsAB0N I1l7yjHuMnLQvJp3Qt6sMZ7q1+yzmNL51scI7HwEgvs/anHWCVq5g2YdgWWiAavmllyv 33bco3/7SuU37txFov2C9J9nRiMxVt56gI6/nkw1S1aL1Lo8OnEsOTJqVvMYb2E2wSsr LWPzlbM+vTtUe/5IlVj3PAsaYh+tfHxn7SqF0AJ2EFU5j/OlvspjQ811Q2DQn7UtONyb Ai8+4jTuYVxzXo7OW9+tC6338s8C/FpAo/DI6qwz1L2tUztbXe2ygSZ1umNDvbwUF97l EnxA== 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=PWsfNMN5PkaAHxS3BXQS/eBEFhHeKuE4fTldXRDNVXo=; b=Yyt5kd7oERjAlvzjTTFA7Zw+1B4fd5hF3vGMc+32oFZLgKBmu/4d/gH/yjC8FGPykX ZK+vilioDbaGhwW3JrfYjf/VOFSZIi6HdDUs0oV/zwK8Dz3HQVIQ7eRmCUAYw9+mlE32 5Uds/GG+GKCL2EOO2d7Db+mbbHVvPm1iz4osmrGGjVgPoiR7kBlFE0QFtJVQYmgcMp/d vgZyaAE+c9f/62StfYZY6vb+utlJnm7I6hoCoQfhKQC97G9v/f0TnO6JHDpJaAsAUToz shmSx4OsZsSry+ULM2Jnl4T2pxbMDGOyVM+ybB/YaZMtaZyKZXOQVmt/WgX/F41TuyYM 13Aw== X-Gm-Message-State: AE9vXwM1JAVRM+G/vPZwJK01rI+z/Jgt8hTzEG81kWwfrOpHXcbcc3N1J9gWPfur7bosMg== X-Received: by 10.25.39.67 with SMTP id n64mr3829507lfn.80.1473705192234; Mon, 12 Sep 2016 11:33:12 -0700 (PDT) Received: from localhost.localdomain ([87.116.212.139]) by smtp.gmail.com with ESMTPSA id s3sm3318460lja.49.2016.09.12.11.33.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Sep 2016 11:33:11 -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 Cc: will.deacon@arm.com, catalin.marinas@arm.com, hanjun.guo@linaro.org, shijie.huang@arm.com, robert.richter@caviumnetworks.com, mw@semihalf.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-acpi@lists.linaro.org, andrea.gallo@linaro.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, al.stone@linaro.org, graeme.gregory@linaro.org, ddaney.cavm@gmail.com, okaya@codeaurora.org, Tomasz Nowicki Subject: [PATCH V11 3/8] PCI/MSI: Setup MSI domain on a per-device basis using IORT ACPI table Date: Mon, 12 Sep 2016 20:32:22 +0200 Message-Id: <1473705147-6588-4-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473705147-6588-1-git-send-email-tn@semihalf.com> References: <1473705147-6588-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 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 98f1222..137b4c5 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1502,8 +1503,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; } @@ -1519,9 +1520,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 */