Re: [PATCH v1 2/2] vfio/pci: Emulate PASID/PRI capability for VFs

From: Alex Williamson
Date: Mon Apr 13 2020 - 15:10:21 EST


On Sun, 12 Apr 2020 20:29:31 -0700
"Raj, Ashok" <ashok.raj@xxxxxxxxx> wrote:

> Hi Alex
>
> Going through the PCIe Spec, there seems a lot of such capabilities
> that are different between PF and VF. Some that make sense
> and some don't.
>
>
> On Sun, Apr 12, 2020 at 08:10:43PM -0700, Raj, Ashok wrote:
> >
> > >
> > > I agree though, I don't know why the SIG would preclude implementing
> > > per VF control of these features. Thanks,
> > >
>
> For e.g.
>
> VF doesn't have I/O and Mem space enables, but has BME

VFs don't have I/O, so I/O enable is irrelevant. The memory enable bit
is emulated, so it doesn't really do anything from the VM perspective.
The hypervisor could provide more emulation around this, but it hasn't
proven necessary.

> Interrupt Status

VFs don't have INTx, so this is irrelevant.

> Correctable Error Reporting
> Almost all of Device Control Register.

Are we doing anything to virtualize these for VFs? I think we've
addressed access control to these for PFs, but I don't see that we try
to virtualize them for the VF.

> So it seems like there is a ton of them we have to deal with today for
> VF's. How do we manage to emulate them without any support for them
> in VF's?

The memory enable bit is just access to the MMIO space of the device,
the hypervisor could choose to do more, but currently emulating the bit
itself is sufficient. This doesn't really affect the device, just
access to the device. The device control registers, I don't think
we've had a need to virtualize them yet and I think we'd run into many
of the same questions. If your point is that there exists gaps in the
spec that make things difficult to virtualize, I won't argue with you
there. MPS is a nearby one that's difficult to virtualize on the PF
since its setting needs to take entire communication channels into
account.

So far though we aren't inventing new capabilities to add to VF config
space and pretending they work, we're just stumbling on what the VF
exposes whether on bare metal or in a VM. Thanks,

Alex