On Mon, Apr 28, 2025 at 12:41:33AM +0000, Tian, Kevin wrote:
> > From: Baolu Lu <baolu...@linux.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.gf1365...@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

Reply via email to