Skip to content

Commit 69d2689

Browse files
nicolincjgunthorpe
authored andcommitted
iommufd: Add alloc_domain_nested op to iommufd_viommu_ops
Allow IOMMU driver to use a vIOMMU object that holds a nesting parent hwpt/domain to allocate a nested domain. Link: https://patch.msgid.link/r/2dcdb5e405dc0deb68230564530d989d285d959c.1730836219.git.nicolinc@nvidia.com Suggested-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 4db97c2 commit 69d2689

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/linux/iommufd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
struct device;
1515
struct file;
1616
struct iommu_group;
17+
struct iommu_user_data;
1718
struct iommufd_access;
1819
struct iommufd_ctx;
1920
struct iommufd_device;
@@ -95,9 +96,17 @@ struct iommufd_viommu {
9596
* struct iommufd_viommu_ops - vIOMMU specific operations
9697
* @destroy: Clean up all driver-specific parts of an iommufd_viommu. The memory
9798
* of the vIOMMU will be free-ed by iommufd core after calling this op
99+
* @alloc_domain_nested: Allocate a IOMMU_DOMAIN_NESTED on a vIOMMU that holds a
100+
* nesting parent domain (IOMMU_DOMAIN_PAGING). @user_data
101+
* must be defined in include/uapi/linux/iommufd.h.
102+
* It must fully initialize the new iommu_domain before
103+
* returning. Upon failure, ERR_PTR must be returned.
98104
*/
99105
struct iommufd_viommu_ops {
100106
void (*destroy)(struct iommufd_viommu *viommu);
107+
struct iommu_domain *(*alloc_domain_nested)(
108+
struct iommufd_viommu *viommu, u32 flags,
109+
const struct iommu_user_data *user_data);
101110
};
102111

103112
#if IS_ENABLED(CONFIG_IOMMUFD)

0 commit comments

Comments
 (0)