iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] iommu/arm: Add module parameter to set msi iova address
@ 2020-09-14 18:13 Vennila Megavannan
  2020-09-21 20:45 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Vennila Megavannan @ 2020-09-14 18:13 UTC (permalink / raw)
  To: will, robin.murphy, joro
  Cc: jean-philippe, linux-kernel, iommu, tyhicks, srinath.mannam,
	bcm-kernel-feedback-list, linux-arm-kernel

From: Srinath Mannam <srinath.mannam@broadcom.com>

Add provision to change default value of MSI IOVA base to platform's
suitable IOVA using module parameter. The present hardcoded MSI IOVA base
may not be the accessible IOVA ranges of platform.

If any platform has the limitaion to access default MSI IOVA, then it can
be changed using "arm-smmu.msi_iova_base=0xa0000000" command line argument.

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Co-developed-by: Vennila Megavannan <vemegava@linux.microsoft.com>
Signed-off-by: Vennila Megavannan <vemegava@linux.microsoft.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 ++++-
 drivers/iommu/arm/arm-smmu/arm-smmu.c       | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index c192544e874b..dfef0df66c19 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -417,6 +417,9 @@ static bool disable_bypass = 1;
 module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);
 MODULE_PARM_DESC(disable_bypass,
 	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
+static unsigned long msi_iova_base = MSI_IOVA_BASE;
+module_param(msi_iova_base, ulong, S_IRUGO);
+MODULE_PARM_DESC(msi_iova_base, "set MSI IOVA base address if default (0x8000000) does not work for your platform.");
 
 enum pri_resp {
 	PRI_RESP_DENY = 0,
@@ -3102,7 +3105,7 @@ static void arm_smmu_get_resv_regions(struct device *dev,
 	struct iommu_resv_region *region;
 	int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
 
-	region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH,
+	region = iommu_alloc_resv_region(msi_iova_base, MSI_IOVA_LENGTH,
 					 prot, IOMMU_RESV_SW_MSI);
 	if (!region)
 		return;
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 09c42af9f31e..9d46a2628dd5 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -64,6 +64,9 @@ static bool disable_bypass =
 module_param(disable_bypass, bool, S_IRUGO);
 MODULE_PARM_DESC(disable_bypass,
 	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
+static unsigned long msi_iova_base = MSI_IOVA_BASE;
+module_param(msi_iova_base, ulong, S_IRUGO);
+MODULE_PARM_DESC(msi_iova_base, "set MSI IOVA base address if default (0x8000000) does not work for your platform.");
 
 struct arm_smmu_s2cr {
 	struct iommu_group		*group;
@@ -1603,7 +1606,7 @@ static void arm_smmu_get_resv_regions(struct device *dev,
 	struct iommu_resv_region *region;
 	int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
 
-	region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH,
+	region = iommu_alloc_resv_region(msi_iova_base, MSI_IOVA_LENGTH,
 					 prot, IOMMU_RESV_SW_MSI);
 	if (!region)
 		return;
-- 
2.17.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iommu/arm: Add module parameter to set msi iova address
  2020-09-14 18:13 [PATCH v2] iommu/arm: Add module parameter to set msi iova address Vennila Megavannan
@ 2020-09-21 20:45 ` Will Deacon
  2020-09-22 22:37   ` Vennila Megavannan
  2020-09-23  6:32   ` Auger Eric
  0 siblings, 2 replies; 5+ messages in thread
From: Will Deacon @ 2020-09-21 20:45 UTC (permalink / raw)
  To: Vennila Megavannan
  Cc: jean-philippe, linux-kernel, iommu, tyhicks, srinath.mannam,
	bcm-kernel-feedback-list, robin.murphy, linux-arm-kernel

On Mon, Sep 14, 2020 at 11:13:07AM -0700, Vennila Megavannan wrote:
> From: Srinath Mannam <srinath.mannam@broadcom.com>
> 
> Add provision to change default value of MSI IOVA base to platform's
> suitable IOVA using module parameter. The present hardcoded MSI IOVA base
> may not be the accessible IOVA ranges of platform.
> 
> If any platform has the limitaion to access default MSI IOVA, then it can
> be changed using "arm-smmu.msi_iova_base=0xa0000000" command line argument.
> 
> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
> Co-developed-by: Vennila Megavannan <vemegava@linux.microsoft.com>
> Signed-off-by: Vennila Megavannan <vemegava@linux.microsoft.com>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 ++++-
>  drivers/iommu/arm/arm-smmu/arm-smmu.c       | 5 ++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)

This feels pretty fragile. Wouldn't it be better to realise that there's
a region conflict with iommu_dma_get_resv_regions() and move the MSI window
accordingly at runtime?

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iommu/arm: Add module parameter to set msi iova address
  2020-09-21 20:45 ` Will Deacon
@ 2020-09-22 22:37   ` Vennila Megavannan
  2020-09-23  6:32   ` Auger Eric
  1 sibling, 0 replies; 5+ messages in thread
From: Vennila Megavannan @ 2020-09-22 22:37 UTC (permalink / raw)
  To: Will Deacon
  Cc: jean-philippe, linux-kernel, iommu, tyhicks, srinath.mannam,
	bcm-kernel-feedback-list, robin.murphy, linux-arm-kernel

Sure, that's a great suggestion, I'll rework on the patch and post again.

Vennila

On 9/21/2020 1:45 PM, Will Deacon wrote:
> On Mon, Sep 14, 2020 at 11:13:07AM -0700, Vennila Megavannan wrote:
>> From: Srinath Mannam <srinath.mannam@broadcom.com>
>>
>> Add provision to change default value of MSI IOVA base to platform's
>> suitable IOVA using module parameter. The present hardcoded MSI IOVA base
>> may not be the accessible IOVA ranges of platform.
>>
>> If any platform has the limitaion to access default MSI IOVA, then it can
>> be changed using "arm-smmu.msi_iova_base=0xa0000000" command line argument.
>>
>> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
>> Co-developed-by: Vennila Megavannan <vemegava@linux.microsoft.com>
>> Signed-off-by: Vennila Megavannan <vemegava@linux.microsoft.com>
>> ---
>>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 ++++-
>>   drivers/iommu/arm/arm-smmu/arm-smmu.c       | 5 ++++-
>>   2 files changed, 8 insertions(+), 2 deletions(-)
> This feels pretty fragile. Wouldn't it be better to realise that there's
> a region conflict with iommu_dma_get_resv_regions() and move the MSI window
> accordingly at runtime?
>
> Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iommu/arm: Add module parameter to set msi iova address
  2020-09-21 20:45 ` Will Deacon
  2020-09-22 22:37   ` Vennila Megavannan
@ 2020-09-23  6:32   ` Auger Eric
  2020-09-28 20:56     ` Will Deacon
  1 sibling, 1 reply; 5+ messages in thread
From: Auger Eric @ 2020-09-23  6:32 UTC (permalink / raw)
  To: Will Deacon, Vennila Megavannan
  Cc: jean-philippe, linux-kernel, iommu, tyhicks, srinath.mannam,
	bcm-kernel-feedback-list, robin.murphy, linux-arm-kernel

Hi Will,

On 9/21/20 10:45 PM, Will Deacon wrote:
> On Mon, Sep 14, 2020 at 11:13:07AM -0700, Vennila Megavannan wrote:
>> From: Srinath Mannam <srinath.mannam@broadcom.com>
>>
>> Add provision to change default value of MSI IOVA base to platform's
>> suitable IOVA using module parameter. The present hardcoded MSI IOVA base
>> may not be the accessible IOVA ranges of platform.
>>
>> If any platform has the limitaion to access default MSI IOVA, then it can
>> be changed using "arm-smmu.msi_iova_base=0xa0000000" command line argument.
>>
>> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
>> Co-developed-by: Vennila Megavannan <vemegava@linux.microsoft.com>
>> Signed-off-by: Vennila Megavannan <vemegava@linux.microsoft.com>
>> ---
>>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 ++++-
>>  drivers/iommu/arm/arm-smmu/arm-smmu.c       | 5 ++++-
>>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> This feels pretty fragile. Wouldn't it be better to realise that there's
> a region conflict with iommu_dma_get_resv_regions() and move the MSI window
> accordingly at runtime?

Since cd2c9fcf5c66 ("iommu/dma: Move PCI window region reservation back
into dma specific path"), the PCI host bridge windows are not exposed by
iommu_dma_get_resv_regions() anymore. If I understood correctly, what is
attempted here is to avoid the collision between such PCI host bridge
window and the MSI IOVA range.

Thanks

Eric
> 
> Will
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iommu/arm: Add module parameter to set msi iova address
  2020-09-23  6:32   ` Auger Eric
@ 2020-09-28 20:56     ` Will Deacon
  0 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-09-28 20:56 UTC (permalink / raw)
  To: Auger Eric
  Cc: tyhicks, jean-philippe, linux-kernel, iommu, Vennila Megavannan,
	srinath.mannam, bcm-kernel-feedback-list, robin.murphy,
	linux-arm-kernel

On Wed, Sep 23, 2020 at 08:32:43AM +0200, Auger Eric wrote:
> On 9/21/20 10:45 PM, Will Deacon wrote:
> > On Mon, Sep 14, 2020 at 11:13:07AM -0700, Vennila Megavannan wrote:
> >> From: Srinath Mannam <srinath.mannam@broadcom.com>
> >>
> >> Add provision to change default value of MSI IOVA base to platform's
> >> suitable IOVA using module parameter. The present hardcoded MSI IOVA base
> >> may not be the accessible IOVA ranges of platform.
> >>
> >> If any platform has the limitaion to access default MSI IOVA, then it can
> >> be changed using "arm-smmu.msi_iova_base=0xa0000000" command line argument.
> >>
> >> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
> >> Co-developed-by: Vennila Megavannan <vemegava@linux.microsoft.com>
> >> Signed-off-by: Vennila Megavannan <vemegava@linux.microsoft.com>
> >> ---
> >>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 5 ++++-
> >>  drivers/iommu/arm/arm-smmu/arm-smmu.c       | 5 ++++-
> >>  2 files changed, 8 insertions(+), 2 deletions(-)
> > 
> > This feels pretty fragile. Wouldn't it be better to realise that there's
> > a region conflict with iommu_dma_get_resv_regions() and move the MSI window
> > accordingly at runtime?
> 
> Since cd2c9fcf5c66 ("iommu/dma: Move PCI window region reservation back
> into dma specific path"), the PCI host bridge windows are not exposed by
> iommu_dma_get_resv_regions() anymore. If I understood correctly, what is
> attempted here is to avoid the collision between such PCI host bridge
> window and the MSI IOVA range.

Either way, I think the kernel should figure this out at runtime and not
rely on a cmdline option to tell it where to place the region.

Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-28 20:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 18:13 [PATCH v2] iommu/arm: Add module parameter to set msi iova address Vennila Megavannan
2020-09-21 20:45 ` Will Deacon
2020-09-22 22:37   ` Vennila Megavannan
2020-09-23  6:32   ` Auger Eric
2020-09-28 20:56     ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).