RE: [PATCH] Documentation: userspace-api: iommufd: Update HWPT_PAGING and HWPT_NESTED

From: Tian, Kevin
Date: Wed Sep 11 2024 - 04:07:05 EST


> From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Sent: Wednesday, September 11, 2024 3:31 PM
>
> On Wed, Sep 11, 2024 at 07:09:15AM +0000, Tian, Kevin wrote:
> > > From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> > > Sent: Wednesday, September 11, 2024 4:41 AM
> > >
> > > -3. IOMMUFD_OBJ_HW_PAGETABLE is created when an external driver
> calls
> > > the IOMMUFD
> > > +3. IOMMUFD_OBJ_HWPT_PAGING can be created in two ways:
> > > +
> > > + IOMMUFD_OBJ_HWPT_PAGING is created when an external driver
> calls
> > > the IOMMUFD
> > > kAPI to attach a bound device to an IOAS. Similarly the external driver
> uAPI
> > > allows userspace to initiate the attaching operation. If a compatible
> > > pagetable already exists then it is reused for the attachment. Otherwise
> a
> > > new pagetable object and iommu_domain is created. Successful
> > > completion of
> > > this operation sets up the linkages among IOAS, device and
> > > iommu_domain. Once
> > > - this completes the device could do DMA.
> > > -
> > > - Every iommu_domain inside the IOAS is also represented to userspace
> as
> > > a
> > > - HW_PAGETABLE object.
> > > + this completes the device could do DMA. Note that every
> iommu_domain
> > > inside
> > > + the IOAS is also represented to userspace as an
> > > IOMMUFD_OBJ_HWPT_PAGING.
> >
> > the last sentence is redundant. here we are talking about how
> HWPT_PAGING
> > is created so it's implied. probably you can state that HWPT_PAGING object
> > is created when talking about "otherwise a new page table object and
> > iommu_domain is created".
>
> I don't quite get this part...where is the redundancy? And where
> is "otherwise a new page table object .."?

the original text:

allows userspace to initiate the attaching operation. If a compatible
pagetable already exists then it is reused for the attachment. Otherwise a
new pagetable object and iommu_domain is created. Successful completion of

it's clear to say that HWPT_PAGING object is created upon successful
completion there. Then naturally every iommu_domain in an IOAS
is represented to userspace as HWPT_PAGING. Not added by you
but could be cleaned up while at it. 😊