Skip to contentSkip to conversation

iommu: Set owner token to SVA domain

PATCH Applied Lu Baolu 4 participants 4 messages Dec 8, 2023 – Dec 12, 2023 IOMMU

lore
Share & tools
lore

Lu Baolu

author
#0 lore raw

PATCH v2 1/1 iommu: Set owner token to SVA domain

Commit a9c362db3920 ("iommu: Validate that devices match domains") added an owner token to the iommu_domain. This token is checked during domain attachment to RID or PASID through the generic iommu interfaces.

The SVA domains are attached to PASIDs through those iommu interfaces. Therefore, they require the owner token to be set during allocation. Otherwise, they fail to attach.

Set the owner token for SVA domains.

Fixes a9c362db3920 ("iommu: Validate that devices match domains")
Cc Robin Murphy <[email protected]>
---
 drivers/iommu/iommu.c | 1 +
 1 file changed, 1 insertion(+)

Change log:
v2:
- The user domain allocation path does the right thing. Hence no need
to fix anything.
v1:
- https://lore.kernel.org/linux-iommu/[email protected]/

drivers/iommu/iommu.c +1 -0
index 0d25468d53a6..d0a28667479a 100644
@@ -3617,6 +3617,7 @@ struct iommu_domain *iommu_sva_domain_alloc(struct device *dev,
 	domain->type = IOMMU_DOMAIN_SVA;
 	mmgrab(mm);
 	domain->mm = mm;
+	domain->owner = ops;
 	domain->iopf_handler = iommu_sva_handle_iopf;
 	domain->fault_data = mm;
 
Signature · 1 line
2.34.1
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Lu Baolu

Commit a9c362db3920 ("iommu: Validate that devices match domains") added an owner token to the iommu_domain. This token is checked during domain attachment to RID or PASID through the generic iommu interfaces.

The SVA domains are attached to PASIDs through those iommu interfaces. Therefore, they require the owner token to be set during allocation. Otherwise, they fail to attach.

Set the owner token for SVA domains.

Quoted 26 lines
Fixes a9c362db3920 ("iommu: Validate that devices match domains")
Cc Robin Murphy <[email protected]>
---
  drivers/iommu/iommu.c | 1 +
  1 file changed, 1 insertion(+)

Change log:
v2:
- The user domain allocation path does the right thing. Hence no need
to fix anything.
v1:
- https://lore.kernel.org/linux-iommu/[email protected]/

drivers/iommu/iommu.c +1 -0
index 0d25468d53a6..d0a28667479a 100644
@@ -3617,6 +3617,7 @@ struct iommu_domain *iommu_sva_domain_alloc(struct device *dev,
  	domain->type = IOMMU_DOMAIN_SVA;
  	mmgrab(mm);
  	domain->mm = mm;
+	domain->owner = ops;
  	domain->iopf_handler = iommu_sva_handle_iopf;
  	domain->fault_data = mm;
 
Reviewed-by on v2 1/1
#2 lore raw
In reply to Lu Baolu
Quoted 8 lines · Lu Baolu

Commit a9c362db3920 ("iommu: Validate that devices match domains") added an owner token to the iommu_domain. This token is checked during domain attachment to RID or PASID through the generic iommu interfaces.

The SVA domains are attached to PASIDs through those iommu interfaces. Therefore, they require the owner token to be set during allocation. Otherwise, they fail to attach.

Quoted 8 lines

Set the owner token for SVA domains.

Fixes a9c362db3920 ("iommu: Validate that devices match domains")
Cc Robin Murphy <[email protected]>
---
 drivers/iommu/iommu.c | 1 +
 1 file changed, 1 insertion(+)

Jason