From: Nicolin Chen <nicolinc@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "jgg@nvidia.com" <jgg@nvidia.com>,
"corbet@lwn.net" <corbet@lwn.net>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Liu, Yi L" <yi.l.liu@intel.com>,
"eric.auger@redhat.com" <eric.auger@redhat.com>,
"shameerali.kolothum.thodi@huawei.com"
<shameerali.kolothum.thodi@huawei.com>,
"smostafa@google.com" <smostafa@google.com>,
"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>
Subject: Re: [PATCH] Documentation: userspace-api: iommufd: Update HWPT_PAGING and HWPT_NESTED
Date: Wed, 11 Sep 2024 12:52:20 -0700 [thread overview]
Message-ID: <ZuH09DoinsRJ9sCq@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB5276C5EEA6AAF9540707AD238C9B2@BN9PR11MB5276.namprd11.prod.outlook.com>
On Wed, Sep 11, 2024 at 08:06:48AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@nvidia.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@nvidia.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
prev parent reply other threads:[~2024-09-11 19:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 20:41 [PATCH] Documentation: userspace-api: iommufd: Update HWPT_PAGING and HWPT_NESTED Nicolin Chen
2024-09-11 2:13 ` Bagas Sanjaya
2024-09-11 4:24 ` Nicolin Chen
2024-09-11 7:28 ` Bagas Sanjaya
2024-09-11 7:09 ` Tian, Kevin
2024-09-11 7:30 ` Nicolin Chen
2024-09-11 8:06 ` Tian, Kevin
2024-09-11 19:52 ` Nicolin Chen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZuH09DoinsRJ9sCq@nvidia.com \
--to=nicolinc@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=corbet@lwn.net \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=smostafa@google.com \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).