> 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: > potentially come from the KVM instance? If so, how about retrieving it > directly from a struct kvm pointer? My understanding is that vIOMMU in > IOMMUFD acts as a handle to KVM, so perhaps we should maintain a > reference to the kvm pointer within the iommufd_viommu structure? > It's OK to maintain a KVM pointer in viommu (for which I recall such discussion for confidential io), but obviously it's not the requirement in this series.