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


Groups > linux.kernel > #1389857 > unrolled thread

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

Started byEric Auger <eric.auger@linaro.org>
First post2016-04-28 10:30 +0200
Last post2016-05-04 15:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [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

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

FromEric Auger <eric.auger@linaro.org>
Date2016-04-28 10:30 +0200
Subject[PATCH v8 8/8] genirq/msi: use the MSI doorbell's IOVA when requested
Message-ID<rsPuF-4Y-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


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

FromMarc Zyngier <marc.zyngier@arm.com>
Date2016-05-04 15:30 +0200
SubjectRe: [PATCH v8 8/8] genirq/msi: use the MSI doorbell's IOVA when requested
Message-ID<rv52i-4BT-25@gated-at.bofh.it>
In reply to#1389857
On 28/04/16 09:22, Eric Auger wrote:
> 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

Nit: Braces on both sides of the '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;
>  }
> 

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web