[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aA/EBa1wQgUQgLKj@Asurada-Nvidia>
Date: Mon, 28 Apr 2025 11:08:05 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>, "Tian, Kevin" <kevin.tian@...el.com>
CC: "jgg@...dia.com" <jgg@...dia.com>, "corbet@....net" <corbet@....net>,
"will@...nel.org" <will@...nel.org>, "bagasdotme@...il.com"
<bagasdotme@...il.com>, "robin.murphy@....com" <robin.murphy@....com>,
"joro@...tes.org" <joro@...tes.org>, "thierry.reding@...il.com"
<thierry.reding@...il.com>, "vdumpa@...dia.com" <vdumpa@...dia.com>,
"jonathanh@...dia.com" <jonathanh@...dia.com>, "shuah@...nel.org"
<shuah@...nel.org>, "jsnitsel@...hat.com" <jsnitsel@...hat.com>,
"nathan@...nel.org" <nathan@...nel.org>, "peterz@...radead.org"
<peterz@...radead.org>, "Liu, Yi L" <yi.l.liu@...el.com>,
"mshavit@...gle.com" <mshavit@...gle.com>, "praan@...gle.com"
<praan@...gle.com>, "zhangzekun11@...wei.com" <zhangzekun11@...wei.com>,
"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>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-tegra@...r.kernel.org"
<linux-tegra@...r.kernel.org>, "linux-kselftest@...r.kernel.org"
<linux-kselftest@...r.kernel.org>, "patches@...ts.linux.dev"
<patches@...ts.linux.dev>, "mochs@...dia.com" <mochs@...dia.com>,
"alok.a.tiwari@...cle.com" <alok.a.tiwari@...cle.com>, "vasant.hegde@....com"
<vasant.hegde@....com>
Subject: Re: [PATCH v2 01/22] iommufd/viommu: Add driver-allocated vDEVICE
support
On Mon, Apr 28, 2025 at 12:41:33AM +0000, Tian, Kevin wrote:
> > From: Baolu Lu <baolu.lu@...ux.intel.com>
> > Sent: Sunday, April 27, 2025 2:24 PM
> >
> > On 4/26/25 13:57, Nicolin Chen wrote:
> > > @@ -120,6 +128,13 @@ struct iommufd_viommu {
> > > * array->entry_num to report the number of handled requests.
> > > * The data structure of the array entry must be defined in
> > > * include/uapi/linux/iommufd.h
> > > + * @vdevice_alloc: Allocate a vDEVICE object and init its driver-level
> > structure
> > > + * or HW procedure. Note that the core-level structure is filled
> > > + * by the iommufd core after calling this op. @virt_id carries a
> > > + * per-vIOMMU virtual ID for the driver to initialize its HW.
> >
> > I'm wondering whether the 'per-vIOMMU virtual ID' is intended to be
> > generic for other features that might require a vdevice. I'm also not
> > sure where this virtual ID originates when I read it here. Could it
>
> for PCI it's the virtual BDF in the guest PCI topology, hence provided
> by the VMM when calling @vdevice_alloc:
The "virtual ID" here can, but not necessarily always, be BDF.
Jason had remarks when we added the ioctl:
https://lore.kernel.org/linux-iommu/20241004114147.GF1365916@nvidia.com/
And uAPI kdoc (include/uapi/linux/iommufd.h) has its description:
/**
* struct iommu_vdevice_alloc - ioctl(IOMMU_VDEVICE_ALLOC)
...
* @virt_id: Virtual device ID per vIOMMU, e.g. vSID of ARM SMMUv3, vDeviceID
* of AMD IOMMU, and vRID of a nested Intel VT-d to a Context Table
So, yes, here we are just forwarding that from the ioctl to viommu
op. Perhaps I should add a line here:
* @vdevice_alloc: Allocate a vDEVICE object and init its driver-level
* or HW procedure. Note that the core-level structure is filled
* by the iommufd core after calling this op. @virt_id carries a
* per-vIOMMU virtual ID (refer to struct iommu_vdevice_alloc in
* include/uapi/linux/iommufd.h) for the driver to initialize its
* HW for an attached physical device.
Thanks
Nicolin
Powered by blists - more mailing lists