Skip to contentSkip to conversation

iommu/amd: Allow non-ATS devices in IOMMUv2 domains

PATCH In review Joerg Roedel 3 participants 4 messages Jul 30, 2015 IOMMU

lore
Share & tools
lore

Joerg Roedel

author maintainer
#0 lore raw

PATCH 1/1 iommu/amd: Allow non-ATS devices in IOMMUv2 domains

From: Joerg Roedel <[email protected]>

With the grouping of multi-function devices a non-ATS capable device might also end up in the same domain as an IOMMUv2 capable device.
So handle this situation gracefully and don't consider it a bug anymore.

---
 drivers/iommu/amd_iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +6 -1
index fa9508b..658ee39 100644
@@ -3318,7 +3318,12 @@ static int __flush_pasid(struct protection_domain *domain, int pasid,
 		struct amd_iommu *iommu;
 		int qdep;
 
-		BUG_ON(!dev_data->ats.enabled);
+		/*
+		   There might be non-IOMMUv2 capable devices in an IOMMUv2
+		 * domain.
+		 */
+		if (!dev_data->ats.enabled)
+			continue;
 
 		qdep  = dev_data->ats.qdep;
 		iommu = amd_iommu_rlookup_table[dev_data->devid];
Signature · 1 line
1.9.1
#1 lore raw

Joerg,
Why amdkfd's devices are considered a non-IOMMUv2 capable devices ? After all, they contain the IOMMUv2 H/W and use it constantly for HSA.

ODed

Quoted 34 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

With the grouping of multi-function devices a non-ATS capable device might also end up in the same domain as an IOMMUv2 capable device.
So handle this situation gracefully and don't consider it a bug anymore.

---
 drivers/iommu/amd_iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +6 -2
index fa9508b..658ee39 100644
@@ -3318,7 +3318,12 @@ static int __flush_pasid(struct protection_domain *domain, int pasid,
                struct amd_iommu *iommu;
                int qdep;
 
-               BUG_ON(!dev_data->ats.enabled);
+               /*
+                  There might be non-IOMMUv2 capable devices in an IOMMUv2
+                * domain.
+                */
+               if (!dev_data->ats.enabled)
+                       continue;
 
                qdep  = dev_data->ats.qdep;
                iommu = amd_iommu_rlookup_table[dev_data->devid];
--

1.9.1

#2 lore raw

Hi Oded,

Quoted 2 lines · Oded Gabbay

Why amdkfd's devices are considered a non-IOMMUv2 capable devices ? After all, they contain the IOMMUv2 H/W and use it constantly for HSA.

With 4.2 the AMD IOMMU driver relies on iommu groups from the iommu core code. With that, all functions of a multi-function device will be in one group (and have to be in one domain). This means that the audio device which comes with every HSA GPU is in the same group, and this device lacks the IOMMUv2 features.

Joerg

Tested-by on v1 1/1
#3 lore raw
In reply to Joerg Roedel
Quoted 32 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

With the grouping of multi-function devices a non-ATS capable device might also end up in the same domain as an IOMMUv2 capable device.
So handle this situation gracefully and don't consider it a bug anymore.

---
 drivers/iommu/amd_iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +6 -2
index fa9508b..658ee39 100644
@@ -3318,7 +3318,12 @@ static int __flush_pasid(struct protection_domain *domain, int pasid,
                struct amd_iommu *iommu;
                int qdep;
 
-               BUG_ON(!dev_data->ats.enabled);
+               /*
+                  There might be non-IOMMUv2 capable devices in an IOMMUv2
+                * domain.
+                */
+               if (!dev_data->ats.enabled)
+                       continue;
 
                qdep  = dev_data->ats.qdep;
                iommu = amd_iommu_rlookup_table[dev_data->devid];
--
Quoted 2 lines

1.9.1

This series, with the additional patch is: