]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommufd: Make attach_handle generic than fault specific
authorNicolin Chen <nicolinc@nvidia.com>
Tue, 4 Feb 2025 05:00:54 +0000 (21:00 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:18:28 +0000 (10:18 +0200)
commit1e0216b6a58c79b5ee91c78706d5f560e4d1f56f
treefdf91066001587305431fa8feb774e323862d82b
parented681e90fb244aa883b918c4d8be2614e816c6df
iommufd: Make attach_handle generic than fault specific

commit fb21b1568adaa76af7a8c853f37c60fba8b28661 upstream.

"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.

Link: https://patch.msgid.link/r/32687df01c02291d89986a9fca897bbbe2b10987.1738645017.git.nicolinc@nvidia.com
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/iommufd/device.c
drivers/iommu/iommufd/fault.c
drivers/iommu/iommufd/iommufd_private.h