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

Jason Gunthorpe
2025-05-12T15:52:45Z

On Sat, May 10, 2025 at 10:51:58PM +1000, Alexey Kardashevskiy wrote:
>
>
> On 10/5/25 08:07, Jason Gunthorpe wrote:
> > On Fri, May 09, 2025 at 12:57:18PM +1000, Alexey Kardashevskiy wrote:
> > >
> > >
> > > On 7/5/25 22:24, Jason Gunthorpe wrote:
> > > > On Wed, May 07, 2025 at 09:18:29PM +1000, Alexey Kardashevskiy wrote:
> > > >
> > > > > > We should not destroy the vdevice for something like that. In a CC
> > > > > > case that would unplug it from the VM which is not right.
> > > > >
> > > > > vdevice is not directly seen by the guest, is not it? The guest will
> > > > > see, for example, an "AMD IOMMU" and assume there is device table
> > > > > for all 64K devices, and so on, it is QEMU which will be
> > > > > reallocating vdevice in the host's IOMMUFD. Did I miss something
> > > > > here? Thanks,
> > > >
> > > > I imagined the vdevice would trigger the CC call to create the vPCI
> > > > function in the guest attached to the secure iommu.
> > >
> > > What is this vPCI going to look like inside the guest? There still
> > > be AMD IOMMU PCI function and passed through to-be-trusted PCI
> > > function.
> >
> > However the VMM tells it to look using the arguments to the create
> > vdevice ioctl?
> >
> > I don't understand the question?
>
> "We should not destroy the vdevice" confused me. It is not a device
> which a VM would see (or is it?),

I think in some cases it will be.

> we can create/destroy at any time (well, may be not, but the VM does
> not have a say in this). And then this vPCI thing - what is it,
> synonym to "vdevice" or a different thing?

When I say vPCI I usually mean the VM's view of the secure virtual
PCI function.

I'm still not completely clear how each of the arches split up the
responsibility to create the vPCI between all the software
components. I'm pretty sure there are quite a few differences here.

Jason