From: Nicolin Chen <nicolinc@nvidia.com>
To: Alexey Kardashevskiy <aik@amd.com>
Cc: <jgg@nvidia.com>, <kevin.tian@intel.com>, <will@kernel.org>,
<joro@8bytes.org>, <suravee.suthikulpanit@amd.com>,
<robin.murphy@arm.com>, <dwmw2@infradead.org>,
<baolu.lu@linux.intel.com>, <shuah@kernel.org>,
<linux-kernel@vger.kernel.org>, <iommu@lists.linux.dev>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kselftest@vger.kernel.org>, <eric.auger@redhat.com>,
<jean-philippe@linaro.org>, <mdf@kernel.org>,
<mshavit@google.com>, <shameerali.kolothum.thodi@huawei.com>,
<smostafa@google.com>, <yi.l.liu@intel.com>,
<zhangfei.gao@linaro.org>, <patches@lists.linux.dev>
Subject: Re: [PATCH v4 00/14] iommufd: Add vIOMMU infrastructure (Part-2: vDEVICE)
Date: Thu, 24 Oct 2024 22:41:53 -0700 [thread overview]
Message-ID: <ZxsvofcC9xSSEMHi@Asurada-Nvidia> (raw)
In-Reply-To: <487ebe2c-718f-405c-8f20-213eab59ca0f@amd.com>
On Fri, Oct 25, 2024 at 04:32:10PM +1100, Alexey Kardashevskiy wrote:
> External email: Use caution opening links or attachments
>
>
> On 25/10/24 15:59, Nicolin Chen wrote:
> > On Fri, Oct 25, 2024 at 03:54:44PM +1100, Alexey Kardashevskiy wrote:
> > > On 22/10/24 11:20, Nicolin Chen wrote:
> > > > Following the previous vIOMMU series, this adds another vDEVICE structure,
> > > > representing the association from an iommufd_device to an iommufd_viommu.
> > > > This gives the whole architecture a new "v" layer:
> > > > _______________________________________________________________________
> > > > | iommufd (with vIOMMU/vDEVICE) |
> > > > | _____________ _____________ |
> > > > | | | | | |
> > > > | |----------------| vIOMMU |<---| vDEVICE |<------| |
> > > > | | | | |_____________| | |
> > > > | | ______ | | _____________ ___|____ |
> > > > | | | | | | | | | | |
> > > > | | | IOAS |<---|(HWPT_PAGING)|<---| HWPT_NESTED |<--| DEVICE | |
> > > > | | |______| |_____________| |_____________| |________| |
> > > > |______|________|______________|__________________|_______________|_____|
> > > > | | | | |
> > > > ______v_____ | ______v_____ ______v_____ ___v__
> > > > | struct | | PFN | (paging) | | (nested) | |struct|
> > > > |iommu_device| |------>|iommu_domain|<----|iommu_domain|<----|device|
> > > > |____________| storage|____________| |____________| |______|
> > > >
> > > > This vDEVICE object is used to collect and store all vIOMMU-related device
> > > > information/attributes in a VM. As an initial series for vDEVICE, add only
> > > > the virt_id to the vDEVICE, which is a vIOMMU specific device ID in a VM:
> > > > e.g. vSID of ARM SMMUv3, vDeviceID of AMD IOMMU, and vID of Intel VT-d to
> > > > a Context Table. This virt_id helps IOMMU drivers to link the vID to a pID
> > > > of the device against the physical IOMMU instance. This is essential for a
> > > > vIOMMU-based invalidation, where the request contains a device's vID for a
> > > > device cache flush, e.g. ATC invalidation.
> > > >
> > > > Therefore, with this vDEVICE object, support a vIOMMU-based invalidation,
> > > > by reusing IOMMUFD_CMD_HWPT_INVALIDATE for a vIOMMU object to flush cache
> > > > with a given driver data.
> > > >
> > > > As for the implementation of the series, add driver support in ARM SMMUv3
> > > > for a real world use case.
> > > >
> > > > This series is on Github:
> > > > https://github.com/nicolinc/iommufd/commits/iommufd_viommu_p2-v4
> > > >
> > > > For testing, try this "with-rmr" branch:
> > > > https://github.com/nicolinc/iommufd/commits/iommufd_viommu_p2-v4-with-rmr
> > >
> > > Is there any real example of a .vdevice_alloc hook, besides the
> > > selftests? It is not in iommufd_viommu_p2-v4-with-rmr, hence the
> > > question. I am trying to sketch something with this new machinery and
> > > less guessing would be nice. Thanks,
> >
> > No, I am actually dropping that one, and moving the vdevice struct
> > to the private header, as there seems to be no use case:
>
> Why keep it then?
We need that structure to store per-vIOMMU virtual ID. Hiding it
in the core only means we need to provide another vIOMMU APIs for
drivers to look up the ID, v.s. exposing it for drivers to access
directly.
Thanks
Nicolin
next prev parent reply other threads:[~2024-10-25 5:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 0:20 [PATCH v4 00/14] iommufd: Add vIOMMU infrastructure (Part-2: vDEVICE) Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 01/14] iommufd/viommu: Introduce IOMMUFD_OBJ_VDEVICE and its related struct Nicolin Chen
2024-10-25 3:37 ` Nicolin Chen
2024-10-25 7:53 ` Alexey Kardashevskiy
2024-10-25 13:20 ` Jason Gunthorpe
2024-10-25 16:39 ` Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 02/14] iommufd/viommu: Add IOMMU_VDEVICE_ALLOC ioctl Nicolin Chen
2024-10-22 3:40 ` Baolu Lu
2024-10-22 4:40 ` Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 03/14] iommufd/selftest: Add IOMMU_VDEVICE_ALLOC test coverage Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 04/14] iommu/viommu: Add cache_invalidate to iommufd_viommu_ops Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 05/14] iommufd/hw_pagetable: Enforce cache invalidation op on vIOMMU-based hwpt_nested Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 06/14] iommufd: Allow hwpt_id to carry viommu_id for IOMMU_HWPT_INVALIDATE Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 07/14] iommu: Add iommu_copy_struct_from_full_user_array helper Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 08/14] iommufd/viommu: Add vdev_to_dev helper Nicolin Chen
2024-10-25 3:39 ` Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 09/14] iommufd/selftest: Add mock_viommu_cache_invalidate Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 10/14] iommufd/selftest: Add IOMMU_TEST_OP_DEV_CHECK_CACHE test command Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 11/14] iommufd/selftest: Add vIOMMU coverage for IOMMU_HWPT_INVALIDATE ioctl Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 12/14] Documentation: userspace-api: iommufd: Update vDEVICE Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 13/14] iommu/arm-smmu-v3: Add arm_vsmmu_cache_invalidate Nicolin Chen
2024-10-22 0:20 ` [PATCH v4 14/14] iommu/arm-smmu-v3: Allow ATS for IOMMU_DOMAIN_NESTED Nicolin Chen
2024-10-25 4:54 ` [PATCH v4 00/14] iommufd: Add vIOMMU infrastructure (Part-2: vDEVICE) Alexey Kardashevskiy
2024-10-25 4:59 ` Nicolin Chen
2024-10-25 5:32 ` Alexey Kardashevskiy
2024-10-25 5:41 ` Nicolin Chen [this message]
2024-10-25 5:58 ` Alexey Kardashevskiy
2024-10-25 6:14 ` Nicolin Chen
2024-10-25 13:29 ` 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=ZxsvofcC9xSSEMHi@Asurada-Nvidia \
--to=nicolinc@nvidia.com \
--cc=aik@amd.com \
--cc=baolu.lu@linux.intel.com \
--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-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=mshavit@google.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=yi.l.liu@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).