iommu: Add iommu_copy_struct_from_user_array helper
authorNicolin Chen <nicolinc@nvidia.com>
Thu, 11 Jan 2024 04:10:10 +0000 (20:10 -0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 11 Jan 2024 17:01:25 +0000 (13:01 -0400)
commit77785117f9c73fd71a440a5ac86dd80752967adc
tree7ced73b442a6bf4bde9dc770b3b4c3e5999c75c5
parent8c6eabae3807e048b9f17733af5e20500fbf858c
iommu: Add iommu_copy_struct_from_user_array helper

Wrap up the data pointer/num sanity and __iommu_copy_struct_from_user()
call for iommu drivers to copy driver specific data at a specific location
in the struct iommu_user_data_array.

And expect it to be used in cache_invalidate_user ops for example.

Link: https://lore.kernel.org/r/20240111041015.47920-4-yi.l.liu@intel.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Co-developed-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
include/linux/iommu.h