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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 11, 2024 at 08:06:48AM +0000, Tian, Kevin wrote:
> > 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. 😊

I see. I did this:

+3. IOMMUFD_OBJ_HWPT_PAGING can be created in two ways:
+
+   * IOMMUFD_OBJ_HWPT_PAGING is automatically 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 member HWPT_PAGING object exists in the IOAS's HWPT_PAGING
+     list, then it will be reused. Otherwise a new HWPT_PAGING that represents
+     an iommu_domain to userspace will be created, and then added to the list.
+     Successful completion of this operation sets up the linkages among IOAS,
+     device and iommu_domain. Once this completes the device could do DMA.
+
+   * IOMMUFD_OBJ_HWPT_PAGING can be manually created via the IOMMU_HWPT_ALLOC
+     uAPI, provided an ioas_id via @pt_id to associate the new HWPT_PAGING to
+     the corresponding IOAS object. The benefit of this manual allocation is to
+     allow allocation flags (defined in enum iommufd_hwpt_alloc_flags), e.g. it
+     allocates a nesting parent HWPT_PAGING if the IOMMU_HWPT_ALLOC_NEST_PARENT
+     flag is set.

Thanks
Nicolin




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux