Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1389857

[PATCH v8 8/8] genirq/msi: use the MSI doorbell's IOVA when requested

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Eric Auger <eric.auger@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v8 8/8] genirq/msi: use the MSI doorbell's IOVA when requested
Date Thu, 28 Apr 2016 10:30:01 +0200
Message-ID <rsPuF-4Y-1@gated-at.bofh.it> (permalink)
References <rsPuF-4Y-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dud7nQ9ejprpDzoy0gN+YV+Mg8gIusOq/Dqia33fc9A=; b=eGXCP5AVW3wh7hI1DCiQgsyEHHLeMmlM1btZp04BYgbJ+n4TkPFYrFkjG1URGUrXG9 I/GmZtsl2nh/Qm9/hNZkBzoUEru5hJOX6xZHLKXWqBsj/Mx+zfGR0R2Ik0fBAVmJBfqe PBsQdkATUhGYu9CO0IEqwFkHxE8gzxJZAQz40=
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=dud7nQ9ejprpDzoy0gN+YV+Mg8gIusOq/Dqia33fc9A=; b=fsFHvTXyjht7Pe5WPRxK6gW+OkPZ47bwl28pSl0XwAQIBfhhELzEWlEPaE0mqa49uD 5vXJFPtUcim70j81Uw1rFbGCStlm6EW3ja1JDZTAmfW3Tw+WZ0qoifrrzn7EbNCk6y/o 60kIhjHO7UaN3SZ4Ajq549u5lYNyl+AuwKssDSzowMZr8hs4aHgE8h4w+k3NIUgG4NF1 4cG8cVGvcx8GZJn5AGRKbmWWsLIwXLjT+oAl6bCYQ5bUceDDRx0OoLYZXDy3RpT7Hzjk 3EI6OyxpO3MPdcCgJ6UwS+R+lSyk18O16+XR2DpLTqqZTcfrw1ApfpGUBmBEvol6qTXm kbxg==
X-Gm-Message-State AOPr4FWQZz3U2X4EVy8t3+7h3WUb7+UuHNFGzykZxSngY6QTpD9rT0kDmzXXsgdY3ymBdrlV
X-Received by 10.28.150.211 with SMTP id y202mr14780150wmd.41.1461831771845; Thu, 28 Apr 2016 01:22:51 -0700 (PDT)
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 51
Organization linux.* mail to news gateway
X-Original-Cc patches@linaro.org, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, pranav.sawargaonkar@gmail.com, p.fedin@samsung.com, iommu@lists.linux-foundation.org, Jean-Philippe.Brucker@arm.com, julien.grall@arm.com
X-Original-Date Thu, 28 Apr 2016 08:22:10 +0000
X-Original-Message-ID <1461831730-5575-9-git-send-email-eric.auger@linaro.org>
X-Original-References <1461831730-5575-1-git-send-email-eric.auger@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1389857

Show key headers only | View raw


On MSI message composition we now use the MSI doorbell's IOVA in
place of the doorbell's PA in case the device is upstream to an
IOMMU that requires MSI addresses to be mapped. The doorbell's
allocation and mapping happened on an early stage (pci_enable_msi).

Signed-off-by: Eric Auger <eric.auger@linaro.org>

---
v7 -> v8:
- use iommu_msi_msg_pa_to_va
- add WARN_ON

v6 -> v7:
- allocation/mapping is done at an earlier stage. We now just perform
  the iova lookup. So it is safe now to be called in a code that cannot
  sleep. iommu_msi_set_doorbell_iova is moved in the dma-reserved-iommu
  API: I think it cleans things up with respect to various #ifdef CONFIGS.

v5:
- use macros to increase the readability
- add comments
- fix a typo that caused a compilation error if CONFIG_IOMMU_API
  is not set
---
 kernel/irq/msi.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index d5f95e6..835938b 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -64,8 +64,16 @@ static int msi_compose(struct irq_data *irq_data,
 
 	if (erase)
 		memset(msg, 0, sizeof(*msg));
-	else
+	else {
+		struct device *dev;
+
 		ret = irq_chip_compose_msi_msg(irq_data, msg);
+		if (ret)
+			return ret;
+
+		dev = msi_desc_to_dev(irq_data_get_msi_desc(irq_data));
+		WARN_ON(iommu_msi_msg_pa_to_va(dev, msg));
+	}
 
 	return ret;
 }
-- 
1.9.1

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH v8 8/8] genirq/msi: use the MSI doorbell's IOVA when requested Eric Auger <eric.auger@linaro.org> - 2016-04-28 10:30 +0200
  Re: [PATCH v8 8/8] genirq/msi: use the MSI doorbell's IOVA when  requested Marc Zyngier <marc.zyngier@arm.com> - 2016-05-04 15:30 +0200

csiph-web