Re: [PATCH 12/14] iommufd: Add IOMMU_HWPT_ALLOC

Nicolin Chen
2023-03-17T04:02:24Z

On Fri, Mar 17, 2023 at 03:02:26AM +0000, Tian, Kevin wrote:

> > +/**
> > + * struct iommu_hwpt_alloc - ioctl(IOMMU_HWPT_ALLOC)
> > + * @size: sizeof(struct iommu_hwpt_alloc)
> > + * @flags: Must be 0
> > + * @dev_id: The device to allocate this HWPT for
> > + * @pt_id: The IOAS to connect this HWPT to
> > + * @out_hwpt_id: The ID of the new HWPT
> > + * @__reserved: Must be 0
> > + *
> > + * Explicitly allocate a hardware page table object. This is the same object
> > + * type that is returned by iommufd_device_attach() and represents the
> > + * underlying iommu driver's iommu_domain kernel object.
> > + *
> > + * A normal HWPT will be created with the mappings from the given IOAS.
> > + */
>
> 'normal' is a confusing word in this context.

Yea, Eric was asking about a related question in another thread,
because he couldn't get this part. I think we could replace this
"normal" with just "kernel-managed", so eventually it would look
like the following narrative after adding user_data and nesting:

* A kernel-managed HWPT will be created with the mappings from the given IOAS.
* The @data_type for its allocation can be set to IOMMU_HWPT_TYPE_DEFAULT, or
* another type (being listed below) to customize the allocation.
*
* A user-managed HWPT will be created from a given parent HWPT via @pt_id, in
* which the parent HWPT must be allocated previously via the same ioctl from a
* given IOAS. The @data_type must not be set to IOMMU_HWPT_TYPE_DEFAULT but a
* pre-defined type corresponding to the underlying IOMMU hardware.

Thanks
Nic