iommufd: Add IOMMU_HWPT_INVALIDATE
authorYi Liu <yi.l.liu@intel.com>
Thu, 11 Jan 2024 04:10:09 +0000 (20:10 -0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 11 Jan 2024 16:55:04 +0000 (12:55 -0400)
commit8c6eabae3807e048b9f17733af5e20500fbf858c
tree80727e96b2fa2344e894215a4861703bac79ed32
parentf35b88b66fbb5c90298ce3aa483b8a2cf1f39ad0
iommufd: Add IOMMU_HWPT_INVALIDATE

In nested translation, the stage-1 page table is user-managed but cached
by the IOMMU hardware, so an update on present page table entries in the
stage-1 page table should be followed with a cache invalidation.

Add an IOMMU_HWPT_INVALIDATE ioctl to support such a cache invalidation.
It takes hwpt_id to specify the iommu_domain, and a multi-entry array to
support multiple invalidation data in one ioctl.

enum iommu_hwpt_invalidate_data_type is defined to tag the data type of
the entries in the multi-entry array.

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