Re: [RFC PATCH 0/7] vfio/pci: SR-IOV support
From: Alex Williamson
Date: Wed Feb 05 2020 - 09:18:38 EST
On Wed, 5 Feb 2020 07:57:36 +0000
"Liu, Yi L" <yi.l.liu@xxxxxxxxx> wrote:
> > From: Alex Williamson <alex.williamson@xxxxxxxxxx>
> > Sent: Wednesday, February 5, 2020 7:18 AM
> > To: kvm@xxxxxxxxxxxxxxx
> > Subject: Re: [RFC PATCH 0/7] vfio/pci: SR-IOV support
> >
> >
> > Promised example QEMU test case...
> >
> > commit 3557c63bcb286c71f3f7242cad632edd9e297d26
> > Author: Alex Williamson <alex.williamson@xxxxxxxxxx>
> > Date: Tue Feb 4 13:47:41 2020 -0700
> >
> > vfio-pci: QEMU support for vfio-pci VF tokens
> >
> > Example support for using a vf_token to gain access to a device as
> > well as using the VFIO_DEVICE_FEATURE interface to set the VF token.
> > Note that the kernel will disregard the additional option where it's
> > not required, such as opening the PF with no VF users, so we can
> > always provide it.
> >
> > NB. It's unclear whether there's value to this QEMU support without
> > further exposure of SR-IOV within a VM. This is meant mostly as a
> > test case where the real initial users will likely be DPDK drivers.
> >
> > Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
>
> Just curious how UUID is used across the test. Should the QEMU
> which opens VFs add the vfio_token=UUID or the QEMU which
> opens PF add the vfio_token=UUID? or both should add vfio_token=UUID.
In this example we do both as this covers the case where there are
existing VF users, which requires the PF to also provide the vf_token.
If there are no VF users, the PF is not required to provide a vf_token
and vfio-pci will not fail the device match if a vf_token is provided
but not needed. In fact, when a PF is probed by vfio-pci a random
vf_token is set, so it's required to use a PF driver to set a known
vf_token before any VF users can access their VFs. Thanks,
Alex