* [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging
@ 2024-09-08 11:42 Yi Liu
2024-09-08 11:42 ` [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call Yi Liu
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Yi Liu @ 2024-09-08 11:42 UTC (permalink / raw)
To: joro, jgg, kevin.tian; +Cc: nicolinc, kvm, yi.l.liu, iommu, baolu.lu
Hi,
Two misc patches per the iommufd iopf merging. Please feel free comment.
Regards,
Yi Liu
Yi Liu (2):
iommufd: Avoid duplicated __iommu_group_set_core_domain() call
iommu: Set iommu_attach_handle->domain in core
drivers/iommu/iommu.c | 1 +
drivers/iommu/iommufd/fault.c | 1 -
drivers/iommu/iommufd/iommufd_private.h | 4 +++-
3 files changed, 4 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call
2024-09-08 11:42 [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Yi Liu
@ 2024-09-08 11:42 ` Yi Liu
2024-09-09 7:29 ` Baolu Lu
2024-09-11 6:33 ` Tian, Kevin
2024-09-08 11:42 ` [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core Yi Liu
2024-09-14 14:13 ` [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Jason Gunthorpe
2 siblings, 2 replies; 8+ messages in thread
From: Yi Liu @ 2024-09-08 11:42 UTC (permalink / raw)
To: joro, jgg, kevin.tian; +Cc: nicolinc, kvm, yi.l.liu, iommu, baolu.lu
For the fault-capable hwpts, the iommufd_hwpt_detach_device() calls both
iommufd_fault_domain_detach_dev() and iommu_detach_group(). This would have
duplicated __iommu_group_set_core_domain() call since both functions call
it in the end. This looks no harm as the __iommu_group_set_core_domain()
returns if the new domain equals to the existing one. But it makes sense to
avoid such duplicated calls in caller side.
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
drivers/iommu/iommufd/iommufd_private.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h
index 92efe30a8f0d..1141c0633dc9 100644
--- a/drivers/iommu/iommufd/iommufd_private.h
+++ b/drivers/iommu/iommufd/iommufd_private.h
@@ -490,8 +490,10 @@ static inline int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
static inline void iommufd_hwpt_detach_device(struct iommufd_hw_pagetable *hwpt,
struct iommufd_device *idev)
{
- if (hwpt->fault)
+ if (hwpt->fault) {
iommufd_fault_domain_detach_dev(hwpt, idev);
+ return;
+ }
iommu_detach_group(hwpt->domain, idev->igroup->group);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core
2024-09-08 11:42 [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Yi Liu
2024-09-08 11:42 ` [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call Yi Liu
@ 2024-09-08 11:42 ` Yi Liu
2024-09-09 7:31 ` Baolu Lu
2024-09-11 6:33 ` Tian, Kevin
2024-09-14 14:13 ` [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Jason Gunthorpe
2 siblings, 2 replies; 8+ messages in thread
From: Yi Liu @ 2024-09-08 11:42 UTC (permalink / raw)
To: joro, jgg, kevin.tian; +Cc: nicolinc, kvm, yi.l.liu, iommu, baolu.lu
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(-)
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);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call
2024-09-08 11:42 ` [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call Yi Liu
@ 2024-09-09 7:29 ` Baolu Lu
2024-09-11 6:33 ` Tian, Kevin
1 sibling, 0 replies; 8+ messages in thread
From: Baolu Lu @ 2024-09-09 7:29 UTC (permalink / raw)
To: Yi Liu, joro, jgg, kevin.tian; +Cc: baolu.lu, nicolinc, kvm, iommu
On 2024/9/8 19:42, Yi Liu wrote:
> For the fault-capable hwpts, the iommufd_hwpt_detach_device() calls both
> iommufd_fault_domain_detach_dev() and iommu_detach_group(). This would have
> duplicated __iommu_group_set_core_domain() call since both functions call
> it in the end. This looks no harm as the __iommu_group_set_core_domain()
> returns if the new domain equals to the existing one. But it makes sense to
> avoid such duplicated calls in caller side.
>
> Signed-off-by: Yi Liu<yi.l.liu@intel.com>
> ---
> drivers/iommu/iommufd/iommufd_private.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Thanks,
baolu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core
2024-09-08 11:42 ` [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core Yi Liu
@ 2024-09-09 7:31 ` Baolu Lu
2024-09-11 6:33 ` Tian, Kevin
1 sibling, 0 replies; 8+ messages in thread
From: Baolu Lu @ 2024-09-09 7:31 UTC (permalink / raw)
To: Yi Liu, joro, jgg, kevin.tian; +Cc: baolu.lu, nicolinc, kvm, iommu
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call
2024-09-08 11:42 ` [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call Yi Liu
2024-09-09 7:29 ` Baolu Lu
@ 2024-09-11 6:33 ` Tian, Kevin
1 sibling, 0 replies; 8+ messages in thread
From: Tian, Kevin @ 2024-09-11 6:33 UTC (permalink / raw)
To: Liu, Yi L, joro@8bytes.org, jgg@nvidia.com
Cc: nicolinc@nvidia.com, kvm@vger.kernel.org, iommu@lists.linux.dev,
baolu.lu@linux.intel.com
> From: Liu, Yi L <yi.l.liu@intel.com>
> Sent: Sunday, September 8, 2024 7:43 PM
>
> For the fault-capable hwpts, the iommufd_hwpt_detach_device() calls both
> iommufd_fault_domain_detach_dev() and iommu_detach_group(). This
> would have
> duplicated __iommu_group_set_core_domain() call since both functions call
> it in the end. This looks no harm as the __iommu_group_set_core_domain()
> returns if the new domain equals to the existing one. But it makes sense to
> avoid such duplicated calls in caller side.
>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core
2024-09-08 11:42 ` [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core Yi Liu
2024-09-09 7:31 ` Baolu Lu
@ 2024-09-11 6:33 ` Tian, Kevin
1 sibling, 0 replies; 8+ messages in thread
From: Tian, Kevin @ 2024-09-11 6:33 UTC (permalink / raw)
To: Liu, Yi L, joro@8bytes.org, jgg@nvidia.com
Cc: nicolinc@nvidia.com, kvm@vger.kernel.org, iommu@lists.linux.dev,
baolu.lu@linux.intel.com
> 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>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging
2024-09-08 11:42 [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Yi Liu
2024-09-08 11:42 ` [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call Yi Liu
2024-09-08 11:42 ` [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core Yi Liu
@ 2024-09-14 14:13 ` Jason Gunthorpe
2 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2024-09-14 14:13 UTC (permalink / raw)
To: Yi Liu; +Cc: joro, kevin.tian, nicolinc, kvm, iommu, baolu.lu
On Sun, Sep 08, 2024 at 04:42:54AM -0700, Yi Liu wrote:
> Hi,
>
> Two misc patches per the iommufd iopf merging. Please feel free comment.
>
> Regards,
> Yi Liu
>
> Yi Liu (2):
> iommufd: Avoid duplicated __iommu_group_set_core_domain() call
> iommu: Set iommu_attach_handle->domain in core
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-09-14 14:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-08 11:42 [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Yi Liu
2024-09-08 11:42 ` [PATCH 1/2] iommufd: Avoid duplicated __iommu_group_set_core_domain() call Yi Liu
2024-09-09 7:29 ` Baolu Lu
2024-09-11 6:33 ` Tian, Kevin
2024-09-08 11:42 ` [PATCH 2/2] iommu: Set iommu_attach_handle->domain in core Yi Liu
2024-09-09 7:31 ` Baolu Lu
2024-09-11 6:33 ` Tian, Kevin
2024-09-14 14:13 ` [PATCH 0/2] iommufd: Misc cleanups per iommufd iopf merging Jason Gunthorpe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.