From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Nicolin Chen <nicolinc@nvidia.com>, jgg@nvidia.com, kevin.tian@intel.com
Cc: corbet@lwn.net, iommu@lists.linux.dev, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, yi.l.liu@intel.com,
eric.auger@redhat.com, shameerali.kolothum.thodi@huawei.com,
smostafa@google.com, baolu.lu@linux.intel.com
Subject: Re: [PATCH] Documentation: userspace-api: iommufd: Update HWPT_PAGING and HWPT_NESTED
Date: Wed, 11 Sep 2024 09:13:10 +0700 [thread overview]
Message-ID: <ZuD8tsci0JPikUYL@archie.me> (raw)
In-Reply-To: <20240910204111.7969-1-nicolinc@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 4741 bytes --]
On Tue, Sep 10, 2024 at 01:41:11PM -0700, Nicolin Chen wrote:
> +- IOMMUFD_OBJ_HWPT_NESTED, representing an actual hardware I/O page table
> + (i.e. a single struct iommu_domain) managed by user space (e.g. guest OS).
> + "NESTED" indicates that this type of HWPT can be linked to an HWPT_PAGING.
> + It also indicates that it is backed by an iommu_domain that has a type of
> + IOMMU_DOMAIN_NESTED. This must be a stage-1 domain for a device running in
> + the user space (e.g. in a guest VM enabling the IOMMU nested translation
> + feature.) So it must be created with a given nesting parent stage-2 domain
"As such, it must be ..."
> + to associate to. This nested stage-1 page table managed by the user space
> + usually has mappings from guest-level I/O virtual addresses to guest-level
> + physical addresses.
>
> <snipped>...
> + 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.
> +
> + IOMMUFD_OBJ_HWPT_PAGING can be also manually created via the IOMMU_HWPT_ALLOC
> + uAPI, provided an ioas_id via @pt_id to associate the new HWPT_PAGING object
> + to the corresponding IOAS object. The benefit of this manual allocation is to
> + provide 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.
Nested bullet list fits:
---- >8 ---
diff --git a/Documentation/userspace-api/iommufd.rst b/Documentation/userspace-api/iommufd.rst
index 3b0e46017dce22..e3ff476aba097e 100644
--- a/Documentation/userspace-api/iommufd.rst
+++ b/Documentation/userspace-api/iommufd.rst
@@ -115,21 +115,21 @@ creating the objects and links::
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. Note that every iommu_domain inside
- the IOAS is also represented to userspace as an IOMMUFD_OBJ_HWPT_PAGING.
+ * 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. Note that every iommu_domain inside
+ the IOAS is also represented to userspace as an IOMMUFD_OBJ_HWPT_PAGING.
- IOMMUFD_OBJ_HWPT_PAGING can be also manually created via the IOMMU_HWPT_ALLOC
- uAPI, provided an ioas_id via @pt_id to associate the new HWPT_PAGING object
- to the corresponding IOAS object. The benefit of this manual allocation is to
- provide 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.
+ * IOMMUFD_OBJ_HWPT_PAGING can be also manually created via the IOMMU_HWPT_ALLOC
+ uAPI, provided an ioas_id via @pt_id to associate the new HWPT_PAGING object
+ to the corresponding IOAS object. The benefit of this manual allocation is to
+ provide 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.
4. IOMMUFD_OBJ_HWPT_NESTED can be only manually created via the IOMMU_HWPT_ALLOC
uAPI, provided an hwpt_id via @pt_id to associate the new HWPT_NESTED object
> <snipped>...
> + When @pt_id carries an ioas_id to an IOAS object, the IOMMU_HWPT_ALLOC
> + call is instructed to allocate an HWPT_PAGING object only.
> + When @pt_id carries an hwpt_id to an HWPT_PAGING object, the uAPI call
"If instead @pt_id ..."
> + is instructed to allocate an HWPT_NESTED object only.
> + If any other type of object is passed in via the @pt_id, the uAPI call
> + will fail.
Thanks.
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-09-11 2:13 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 [this message]
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
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=ZuD8tsci0JPikUYL@archie.me \
--to=bagasdotme@gmail.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=nicolinc@nvidia.com \
--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).