]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC
authorNicolin Chen <nicolinc@nvidia.com>
Tue, 5 Nov 2024 20:04:23 +0000 (12:04 -0800)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 12 Nov 2024 15:46:18 +0000 (11:46 -0400)
commit13a750180fc86d41695c8f64d8892412482a401d
tree1de7784636ab26956c0b19f79c6faa2527eee03b
parent69d2689e57f5cb235c0609dd2f8fa10c1a832f87
iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC

Now a vIOMMU holds a shareable nesting parent HWPT. So, it can act like
that nesting parent HWPT to allocate a nested HWPT.

Support that in the IOMMU_HWPT_ALLOC ioctl handler, and update its kdoc.

Also, add an iommufd_viommu_alloc_hwpt_nested helper to allocate a nested
HWPT for a vIOMMU object. Since a vIOMMU object holds the parent hwpt's
refcount already, increase the refcount of the vIOMMU only.

Link: https://patch.msgid.link/r/a0f24f32bfada8b448d17587adcaedeeb50a67ed.1730836219.git.nicolinc@nvidia.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/hw_pagetable.c
drivers/iommu/iommufd/iommufd_private.h
include/uapi/linux/iommufd.h