Re: [PATCH v1 1/2] iommufd: Make attach_handle generic than fault specific

From: Yi Liu
Date: Tue Feb 11 2025 - 01:43:02 EST


On 2025/2/4 13:00, Nicolin Chen wrote:
"attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
used by IOPF/PRI use cases. Now, both the MSI and PASID series require to
reuse the attach_handle for non-fault cases.

Add a set of new attach/detach/replace helpers that does the attach_handle
allocation/releasing/replacement in the common path and also handles those
fault specific routines such as iopf enabling/disabling and auto response.

This covers both non-fault and fault cases in a clean way, replacing those
inline helpers in the header. The following patch will clean up those old
helpers in the fault.c file.

Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
---
drivers/iommu/iommufd/iommufd_private.h | 33 +-------
drivers/iommu/iommufd/device.c | 101 ++++++++++++++++++++++++
drivers/iommu/iommufd/fault.c | 8 +-
3 files changed, 109 insertions(+), 33 deletions(-)

Reviewed-by: Yi Liu <yi.l.liu@xxxxxxxxx>


--
Regards,
Yi Liu