Re: [PATCH v2 06/19] iommufd/viommu: Add IOMMU_VIOMMU_SET/UNSET_VDEV_ID ioctl

Nicolin Chen
2025-04-30T08:33:32Z

On Wed, Apr 30, 2025 at 05:54:53PM +1000, Alexey Kardashevskiy wrote:
> On 4/10/24 21:41, Jason Gunthorpe wrote:
> > On Fri, Oct 04, 2024 at 02:32:28PM +1000, Alexey Kardashevskiy wrote:
> >
> > > > + __u32 __reserved;
> > > > + __aligned_u64 vdev_id;
>
> I believe this ended up being "virt_id"...

Yes.

> > >
> > > What is the nature of this id?
> >
> > It should be the vIOMMU's HW representation for the virtual device.
> >
> > On ARM it is the stream id, the index into the Stream Table
> >
> > On AMD it would be the "DeviceID" the index in the Device Table
>
>
> ... and I just hit a problem with it - this is basically guest BDFn
> and it works as long as I'm hotplugging the TEE-IO VF into an SNP VM
> but does not when I pass through via the QEMU cmdline - bus numbers
> are not assigned yet. So I have to postpone the vdevice allocation
> till run time, did I miss something here? Thanks,

I have a similar case with QEMU ARM64's VM: so vDEVICE on ARM is
allocated at runtime as well because the BDF number isn't ready
at the boot time.

Nicolin