Skip to contentSkip to conversation

iommu: Distinguish between sw-msi and msi

PATCH In review Angus Chen 2 participants 4 messages Oct 21, 2024 – Oct 22, 2024 IOMMU

lore
Share & tools
lore

Angus Chen

author
#0 lore raw

PATCH 1/1 iommu: Distinguish between sw-msi and msi

iommu_group_resv_type_string use the same string of IOMMU_RESV_MSI and IOMMU_RESV_SW_MSI, Make a distinction for these.

---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
index 83c8e617a2c5..8a2bbb5c4a91 100644
@@ -84,7 +84,7 @@ static const char * const iommu_group_resv_type_string[] = {
 	[IOMMU_RESV_DIRECT_RELAXABLE]		= "direct-relaxable",
 	[IOMMU_RESV_RESERVED]			= "reserved",
 	[IOMMU_RESV_MSI]			= "msi",
-	[IOMMU_RESV_SW_MSI]			= "msi",
+	[IOMMU_RESV_SW_MSI]			= "sw-msi",
 };
 
 #define IOMMU_CMD_LINE_DMA_API		BIT(0)
Signature · 1 line
2.34.1
reviewer
#1 lore raw
Quoted 2 lines · Angus Chen

iommu_group_resv_type_string use the same string of IOMMU_RESV_MSI and IOMMU_RESV_SW_MSI, Make a distinction for these.

Why? What in userspace needs to know the exact details of how the kernel and the underlying hardware are routing MSIs?

Thanks,
Robin.

Quoted 18 lines
---
  drivers/iommu/iommu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
index 83c8e617a2c5..8a2bbb5c4a91 100644
@@ -84,7 +84,7 @@ static const char * const iommu_group_resv_type_string[] = {
  	[IOMMU_RESV_DIRECT_RELAXABLE]		= "direct-relaxable",
  	[IOMMU_RESV_RESERVED]			= "reserved",
  	[IOMMU_RESV_MSI]			= "msi",
-	[IOMMU_RESV_SW_MSI]			= "msi",
+	[IOMMU_RESV_SW_MSI]			= "sw-msi",
  };
 
  #define IOMMU_CMD_LINE_DMA_API		BIT(0)
author
#2 lore raw

Hi robin。

Quoted 8 lines

-----Original Message-----
From: Robin Murphy <[email protected]>
Sent: Monday, October 21, 2024 7:59 PM
To: Angus Chen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] iommu: Distinguish between sw-msi and msi

Quoted 6 lines
Quoted 2 lines · Angus Chen

iommu_group_resv_type_string use the same string of IOMMU_RESV_MSI and IOMMU_RESV_SW_MSI, Make a distinction for these.

Why? What in userspace needs to know the exact details of how the kernel and the underlying hardware are routing MSIs?

We use smmu-v3 for a dpu design,and we set a private region to handle msi region like x86. We set some private iommu register to control this.
If some customer want to use their os like openouler, we use sw-msi mode. If some customer want to use our customize os ,we will set msi private. Some customer use openouler and we private smmu-v3 module at the same time,

So I want to use reserve-type to distinguish between sw-msi and msi.

Quoted 23 lines

Thanks,
Robin.

drivers/iommu/iommu.c static const char * const

Quoted 10 lines
---
  drivers/iommu/iommu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +0 -0
index 83c8e617a2c5..8a2bbb5c4a91 100644
@@ -84,7 +84,7 @@ static const char * const

iommu_group_resv_type_string[] = {

Quoted 8 lines
drivers/iommu/iommu.c +1 -1
  	[IOMMU_RESV_DIRECT_RELAXABLE]		= "direct-relaxable",
  	[IOMMU_RESV_RESERVED]			= "reserved",
  	[IOMMU_RESV_MSI]			= "msi",
-	[IOMMU_RESV_SW_MSI]			= "msi",
+	[IOMMU_RESV_SW_MSI]			= "sw-msi",
  };
 
  #define IOMMU_CMD_LINE_DMA_API		BIT(0)
reviewer
#3 lore raw
Quoted 16 lines · Angus Chen

Hi robin。

Quoted 8 lines

-----Original Message-----
From: Robin Murphy <[email protected]>
Sent: Monday, October 21, 2024 7:59 PM
To: Angus Chen <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] iommu: Distinguish between sw-msi and msi

Quoted 6 lines
Quoted 2 lines · Angus Chen

iommu_group_resv_type_string use the same string of IOMMU_RESV_MSI and IOMMU_RESV_SW_MSI, Make a distinction for these.

Why? What in userspace needs to know the exact details of how the kernel and the underlying hardware are routing MSIs?

Quoted 7 lines

We use smmu-v3 for a dpu design,and we set a private region to handle msi region like x86. We set some private iommu register to control this.
If some customer want to use their os like openouler, we use sw-msi mode. If some customer want to use our customize os ,we will set msi private. Some customer use openouler and we private smmu-v3 module at the same time,

So I want to use reserve-type to distinguish between sw-msi and msi.

But *why*? What do you expect userspace to do with this information? It was a deliberate choice not to expose this distinction, precisely *because* it should make no difference to a VFIO user whether an MSI address range is defined by the platform or by the IOMMU driver, and if userspace did think it wants to know that then it's probably doing something wrong. IIRC, the reason for distinguishing "msi" from "reserved" at all was just as a hint to userspace that although the address range is still not usable for remapping memory, it's a good place for a VMM to put an emulated MSI doorbell in GPA/IPA space.

Also, this has been userspace ABI since 2017, and changing it has a high risk of breaking existing users who are looking for an "msi" region, so no.

Thanks,
Robin.