linux/drivers/iommu/iommufd
Nicolin Chen bd529dbb66 iommufd: Add a nested HW pagetable object
IOMMU_HWPT_ALLOC already supports iommu_domain allocation for usersapce.
But it can only allocate a hw_pagetable that associates to a given IOAS,
i.e. only a kernel-managed hw_pagetable of IOMMUFD_OBJ_HWPT_PAGING type.

IOMMU drivers can now support user-managed hw_pagetables, for two-stage
translation use cases that require user data input from the user space.

Add a new IOMMUFD_OBJ_HWPT_NESTED type with its abort/destroy(). Pair it
with a new iommufd_hwpt_nested structure and its to_hwpt_nested() helper.
Update the to_hwpt_paging() helper, so a NESTED-type hw_pagetable can be
handled in the callers, for example iommufd_hw_pagetable_enforce_rr().

Screen the inputs including the parent PAGING-type hw_pagetable that has
a need of a new nest_parent flag in the iommufd_hwpt_paging structure.

Extend the IOMMU_HWPT_ALLOC ioctl to accept an IOMMU driver specific data
input which is tagged by the enum iommu_hwpt_data_type. Also, update the
@pt_id to accept hwpt_id too besides an ioas_id. Then, use them to allocate
a hw_pagetable of IOMMUFD_OBJ_HWPT_NESTED type using the
iommufd_hw_pagetable_alloc_nested() allocator.

Link: https://lore.kernel.org/r/20231026043938.63898-8-yi.l.liu@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>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2023-10-26 11:15:57 -03:00
..
device.c iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
double_span.h
hw_pagetable.c iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
io_pagetable.c iommufd: Add a flag to skip clearing of IOPTE dirty 2023-10-24 11:58:43 -03:00
io_pagetable.h
ioas.c iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas() 2023-03-29 16:52:41 -03:00
iommufd_private.h iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
iommufd_test.h iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP 2023-10-24 11:58:44 -03:00
iova_bitmap.c iommufd/iova_bitmap: Move symbols to IOMMUFD namespace 2023-10-24 11:58:42 -03:00
Kconfig vfio: Compile vfio_group infrastructure optionally 2023-07-25 10:20:50 -06:00
main.c iommufd: Add a nested HW pagetable object 2023-10-26 11:15:57 -03:00
Makefile vfio: Move iova_bitmap into iommufd 2023-10-24 11:58:42 -03:00
pages.c iommufd: Set end correctly when doing batch carry 2023-07-27 11:27:20 -03:00
selftest.c iommu: Pass in parent domain with user_data to domain_alloc_user op 2023-10-26 11:15:57 -03:00
vfio_compat.c iommufd: Derive iommufd_hwpt_paging from iommufd_hw_pagetable 2023-10-26 11:15:56 -03:00