diff mbox series

[2/2] iommu: Set iommu_attach_handle->domain in core

Message ID 20240908114256.979518-3-yi.l.liu@intel.com (mailing list archive)
State New, archived
Headers show
Series iommufd: Misc cleanups per iommufd iopf merging | expand

Commit Message

Yi Liu Sept. 8, 2024, 11:42 a.m. UTC
The IOMMU core sets the iommu_attach_handle->domain for the
iommu_attach_group_handle() path, while the iommu_replace_group_handle()
sets it on the caller side. Make the two paths aligned on it.

Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
 drivers/iommu/iommu.c         | 1 +
 drivers/iommu/iommufd/fault.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

Comments

Baolu Lu Sept. 9, 2024, 7:31 a.m. UTC | #1
On 2024/9/8 19:42, Yi Liu wrote:
> The IOMMU core sets the iommu_attach_handle->domain for the
> iommu_attach_group_handle() path, while the iommu_replace_group_handle()
> sets it on the caller side. Make the two paths aligned on it.
> 
> Signed-off-by: Yi Liu<yi.l.liu@intel.com>
> ---
>   drivers/iommu/iommu.c         | 1 +
>   drivers/iommu/iommufd/fault.c | 1 -
>   2 files changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

Thanks,
baolu
Tian, Kevin Sept. 11, 2024, 6:33 a.m. UTC | #2
> From: Liu, Yi L <yi.l.liu@intel.com>
> Sent: Sunday, September 8, 2024 7:43 PM
> 
> The IOMMU core sets the iommu_attach_handle->domain for the
> iommu_attach_group_handle() path, while the
> iommu_replace_group_handle()
> sets it on the caller side. Make the two paths aligned on it.
> 
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
diff mbox series

Patch

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index ed6c5cb60c5a..83c8e617a2c5 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -3578,6 +3578,7 @@  int iommu_replace_group_handle(struct iommu_group *group,
 		ret = xa_reserve(&group->pasid_array, IOMMU_NO_PASID, GFP_KERNEL);
 		if (ret)
 			goto err_unlock;
+		handle->domain = new_domain;
 	}
 
 	ret = __iommu_group_set_domain(group, new_domain);
diff --git a/drivers/iommu/iommufd/fault.c b/drivers/iommu/iommufd/fault.c
index a643d5c7c535..c4715261f2c7 100644
--- a/drivers/iommu/iommufd/fault.c
+++ b/drivers/iommu/iommufd/fault.c
@@ -161,7 +161,6 @@  static int __fault_domain_replace_dev(struct iommufd_device *idev,
 		if (!handle)
 			return -ENOMEM;
 
-		handle->handle.domain = hwpt->domain;
 		handle->idev = idev;
 		ret = iommu_replace_group_handle(idev->igroup->group,
 						 hwpt->domain, &handle->handle);