Archive-only list for patches
 help / color / mirror / Atom feed
From: Yi Liu <yi.l.liu@intel.com>
To: Nicolin Chen <nicolinc@nvidia.com>, <jgg@nvidia.com>,
	<kevin.tian@intel.com>, <corbet@lwn.net>
Cc: <joro@8bytes.org>, <suravee.suthikulpanit@amd.com>,
	<will@kernel.org>, <robin.murphy@arm.com>, <dwmw2@infradead.org>,
	<shuah@kernel.org>, <iommu@lists.linux.dev>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>, <baolu.lu@linux.intel.com>,
	<eric.auger@redhat.com>, <jean-philippe@linaro.org>,
	<mdf@kernel.org>, <mshavit@google.com>,
	<shameerali.kolothum.thodi@huawei.com>, <smostafa@google.com>,
	<aik@amd.com>, <zhangfei.gao@linaro.org>,
	<patches@lists.linux.dev>
Subject: Re: [PATCH v7 13/13] Documentation: userspace-api: iommufd: Update vIOMMU
Date: Tue, 12 Nov 2024 21:15:02 +0800	[thread overview]
Message-ID: <f0c45d5b-b8cd-4f75-a9d7-21808f18583d@intel.com> (raw)
In-Reply-To: <7e4302064e0d02137c1b1e139342affc0485ed3f.1730836219.git.nicolinc@nvidia.com>

On 2024/11/6 04:04, Nicolin Chen wrote:
>   
>   The diagrams below show relationships between user-visible objects and kernel
> @@ -101,6 +132,28 @@ creating the objects and links::
>              |------------>|iommu_domain|<----|iommu_domain|<----|device|
>                            |____________|     |____________|     |______|
>   
> +  _______________________________________________________________________
> + |                      iommufd (with vIOMMU)                            |
> + |                                                                       |
> + |                             [5]                                       |
> + |                        _____________                                  |
> + |                       |             |                                 |
> + |      |----------------|    vIOMMU   |                                 |
> + |      |                |             |                                 |
> + |      |                |             |                                 |
> + |      |      [1]       |             |          [4]             [2]    |
> + |      |     ______     |             |     _____________     ________  |
> + |      |    |      |    |     [3]     |    |             |   |        | |
> + |      |    | IOAS |<---|(HWPT_PAGING)|<---| HWPT_NESTED |<--| DEVICE | |
> + |      |    |______|    |_____________|    |_____________|   |________| |
> + |      |        |              |                  |               |     |
> + |______|________|______________|__________________|_______________|_____|
> +        |        |              |                  |               |
> +  ______v_____   |        ______v_____       ______v_____       ___v__
> + |   struct   |  |  PFN  |  (paging)  |     |  (nested)  |     |struct|
> + |iommu_device|  |------>|iommu_domain|<----|iommu_domain|<----|device|
> + |____________|   storage|____________|     |____________|     |______|
> +
>   1. IOMMUFD_OBJ_IOAS is created via the IOMMU_IOAS_ALLOC uAPI. An iommufd can
>      hold multiple IOAS objects. IOAS is the most generic object and does not
>      expose interfaces that are specific to single IOMMU drivers. All operations
> @@ -132,7 +185,8 @@ creating the objects and links::
>        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
> +   uAPI, provided an hwpt_id or a viommu_id of a vIOMMU object encapsulating a
> +   nesting parent HWPT_PAGING via @pt_id to associate the new HWPT_NESTED object
>      to the corresponding HWPT_PAGING object. The associating HWPT_PAGING object
>      must be a nesting parent manually allocated via the same uAPI previously with
>      an IOMMU_HWPT_ALLOC_NEST_PARENT flag, otherwise the allocation will fail. The
> @@ -149,6 +203,18 @@ creating the objects and links::
>         created via the same IOMMU_HWPT_ALLOC uAPI. The difference is at the type
>         of the object passed in via the @pt_id field of struct iommufd_hwpt_alloc.
>   
> +5. IOMMUFD_OBJ_VIOMMU can be only manually created via the IOMMU_VIOMMU_ALLOC
> +   uAPI, provided a dev_id (for the device's physical IOMMU to back the vIOMMU)
> +   and an hwpt_id (to associate the vIOMMU to a nesting parent HWPT_PAGING). The
> +   iommufd core will link the vIOMMU object to the struct iommu_device that the
> +   struct device is behind. 

It looks to be reasonable to share the viommu_obj between devices behind 
the same physical IOMMU. This design seems no enforcement for it. So it's
all up to userspace from what I got. :)

-- 
Regards,
Yi Liu

  parent reply	other threads:[~2024-11-12 13:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 20:04 [PATCH v7 00/13] iommufd: Add vIOMMU infrastructure (Part-1) Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 01/13] iommufd: Move struct iommufd_object to public iommufd header Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 02/13] iommufd: Move _iommufd_object_alloc helper to a sharable file Nicolin Chen
2024-11-12 15:45   ` Jason Gunthorpe
2024-11-05 20:04 ` [PATCH v7 03/13] iommufd: Introduce IOMMUFD_OBJ_VIOMMU and its related struct Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 04/13] iommufd: Verify object in iommufd_object_finalize/abort() Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 05/13] iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 06/13] iommufd: Add alloc_domain_nested op to iommufd_viommu_ops Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 07/13] iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 08/13] iommufd/selftest: Add container_of helpers Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 09/13] iommufd/selftest: Prepare for mock_viommu_alloc_domain_nested() Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 10/13] iommufd/selftest: Add refcount to mock_iommu_device Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 11/13] iommufd/selftest: Add IOMMU_VIOMMU_TYPE_SELFTEST Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 12/13] iommufd/selftest: Add IOMMU_VIOMMU_ALLOC test coverage Nicolin Chen
2024-11-05 20:04 ` [PATCH v7 13/13] Documentation: userspace-api: iommufd: Update vIOMMU Nicolin Chen
2024-11-07  0:56   ` Bagas Sanjaya
2024-11-07  1:35     ` Nicolin Chen
2024-11-07  3:20       ` Bagas Sanjaya
2024-11-07  4:04         ` Nicolin Chen
2024-11-08  9:01           ` Bagas Sanjaya
2024-11-12 13:15   ` Yi Liu [this message]
2024-11-14  0:18     ` Nicolin Chen
2024-11-14  3:13       ` Yi Liu
2024-11-14  3:18         ` Nicolin Chen
2024-11-14 16:20           ` Jason Gunthorpe
2024-11-15 22:07             ` Nicolin Chen
2024-11-16  0:34               ` Jason Gunthorpe
2024-11-18  6:10                 ` Yi Liu
2024-11-08 17:40 ` [PATCH v7 00/13] iommufd: Add vIOMMU infrastructure (Part-1) Jason Gunthorpe

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=f0c45d5b-b8cd-4f75-a9d7-21808f18583d@intel.com \
    --to=yi.l.liu@intel.com \
    --cc=aik@amd.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=dwmw2@infradead.org \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=jean-philippe@linaro.org \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=mshavit@google.com \
    --cc=nicolinc@nvidia.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=shuah@kernel.org \
    --cc=smostafa@google.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=will@kernel.org \
    --cc=zhangfei.gao@linaro.org \
    /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