lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZuH09DoinsRJ9sCq@nvidia.com>
Date: Wed, 11 Sep 2024 12:52:20 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
CC: "jgg@...dia.com" <jgg@...dia.com>, "corbet@....net" <corbet@....net>,
	"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>, "linux-doc@...r.kernel.org"
	<linux-doc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "Liu, Yi L" <yi.l.liu@...el.com>,
	"eric.auger@...hat.com" <eric.auger@...hat.com>,
	"shameerali.kolothum.thodi@...wei.com"
	<shameerali.kolothum.thodi@...wei.com>, "smostafa@...gle.com"
	<smostafa@...gle.com>, "baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>
Subject: Re: [PATCH] Documentation: userspace-api: iommufd: Update
 HWPT_PAGING and HWPT_NESTED

On Wed, Sep 11, 2024 at 08:06:48AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@...dia.com>
> > 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@...dia.com>
> > > > 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ