[RFC: vf-token 0/5] Introduce vf-token when using userspace PF

Vivek Kashyap posted 5 patches 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20231005230504.16838-1-vivek.kashyap@linux.intel.com
There is a newer version of this series
src/conf/device_conf.c            | 31 +++++++++++++++++++++++++++++--
src/conf/device_conf.h            |  3 +++
src/conf/domain_addr.h            |  1 +
src/conf/domain_conf.c            |  5 +++++
src/conf/schemas/basictypes.rng   | 11 +++++++++++
src/conf/schemas/domaincommon.rng |  1 +
src/libvirt_private.syms          |  1 +
src/qemu/qemu_capabilities.c      |  3 +++
src/qemu/qemu_capabilities.h      |  1 +
src/qemu/qemu_command.c           | 27 ++++++++++++++++++++++++---
src/qemu/qemu_domain_address.c    |  3 +++
src/qemu/qemu_validate.c          | 19 +++++++++++++++++++
src/util/virpci.c                 |  5 +++++
src/util/virpci.h                 | 11 +++++++++++
14 files changed, 117 insertions(+), 5 deletions(-)
[RFC: vf-token 0/5] Introduce vf-token when using userspace PF
Posted by Vivek Kashyap 7 months ago
vf token is set by a vfio-pci based PF driver and it must be known to the
vfio-pci based VF driver. This vf-token is set by the PF driver before VF
drivers can access the device. vfio-pci driver and qemu support vf-token. 
This RFC patch series adds support to provide the vf-token (uuid format) 
in the domain XML and to generate the qemu commandline including the 
vf-token.

To support vf-token the new element will be used as follows:

<hostdev mode='subsystem' type='pci' managed='yes'>
   <driver name='vfio'/>
   <source>
     <address domain='0x0000' bus='0x0' slot='0x00' function='0x1'>
     <vf-token uuid='00112233-4455-6677-8899-aabbccddeeff'/>
     </address>
   </source>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</hostdev>

The generated commandline will include the following:

-device {"driver":"vfio-pci","host":"0000:00:0.1",
         "vf-token":"00112233-4455-6677-8899-aabbccddeeff",
         "id":"hostdev0","bus":"pci.0","addr":"0x1"}

This patch is get feedback on the approach. Will post with add
documentation and testcases in follow-up.

Vivek Kashyap (5):
  virpci: Define vf-token
  qemu: vf-token capability
  conf: vf-token flag
  conf: vf-token parsing and formatting
  qemu: validate and generate vf-token on command line

 src/conf/device_conf.c            | 31 +++++++++++++++++++++++++++++--
 src/conf/device_conf.h            |  3 +++
 src/conf/domain_addr.h            |  1 +
 src/conf/domain_conf.c            |  5 +++++
 src/conf/schemas/basictypes.rng   | 11 +++++++++++
 src/conf/schemas/domaincommon.rng |  1 +
 src/libvirt_private.syms          |  1 +
 src/qemu/qemu_capabilities.c      |  3 +++
 src/qemu/qemu_capabilities.h      |  1 +
 src/qemu/qemu_command.c           | 27 ++++++++++++++++++++++++---
 src/qemu/qemu_domain_address.c    |  3 +++
 src/qemu/qemu_validate.c          | 19 +++++++++++++++++++
 src/util/virpci.c                 |  5 +++++
 src/util/virpci.h                 | 11 +++++++++++
 14 files changed, 117 insertions(+), 5 deletions(-)

-- 
2.25.1
Re: [RFC: vf-token 0/5] Introduce vf-token when using userspace PF
Posted by Peter Krempa 6 months, 4 weeks ago
On Thu, Oct 05, 2023 at 16:04:59 -0700, Vivek Kashyap wrote:
> vf token is set by a vfio-pci based PF driver and it must be known to the
> vfio-pci based VF driver. This vf-token is set by the PF driver before VF
> drivers can access the device. vfio-pci driver and qemu support vf-token. 
> This RFC patch series adds support to provide the vf-token (uuid format) 
> in the domain XML and to generate the qemu commandline including the 
> vf-token.
> 
> To support vf-token the new element will be used as follows:
> 
> <hostdev mode='subsystem' type='pci' managed='yes'>
>    <driver name='vfio'/>
>    <source>
>      <address domain='0x0000' bus='0x0' slot='0x00' function='0x1'>
>      <vf-token uuid='00112233-4455-6677-8899-aabbccddeeff'/>
>      </address>
>    </source>
>   <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
> </hostdev>
> 
> The generated commandline will include the following:
> 
> -device {"driver":"vfio-pci","host":"0000:00:0.1",
>          "vf-token":"00112233-4455-6677-8899-aabbccddeeff",
>          "id":"hostdev0","bus":"pci.0","addr":"0x1"}
> 
> This patch is get feedback on the approach. Will post with add
> documentation and testcases in follow-up.
> 
> Vivek Kashyap (5):
>   virpci: Define vf-token
>   qemu: vf-token capability
>   conf: vf-token flag
>   conf: vf-token parsing and formatting
>   qemu: validate and generate vf-token on command line

Please note that my forthcoming review will not include any comments on
whether this feature itself makes sense or whether the XML desing you
are proposing is reasonable ...

>  src/conf/device_conf.c            | 31 +++++++++++++++++++++++++++++--
>  src/conf/device_conf.h            |  3 +++
>  src/conf/domain_addr.h            |  1 +
>  src/conf/domain_conf.c            |  5 +++++
>  src/conf/schemas/basictypes.rng   | 11 +++++++++++
>  src/conf/schemas/domaincommon.rng |  1 +
>  src/libvirt_private.syms          |  1 +
>  src/qemu/qemu_capabilities.c      |  3 +++
>  src/qemu/qemu_capabilities.h      |  1 +
>  src/qemu/qemu_command.c           | 27 ++++++++++++++++++++++++---
>  src/qemu/qemu_domain_address.c    |  3 +++
>  src/qemu/qemu_validate.c          | 19 +++++++++++++++++++
>  src/util/virpci.c                 |  5 +++++
>  src/util/virpci.h                 | 11 +++++++++++
>  14 files changed, 117 insertions(+), 5 deletions(-)

This is mostly because the patches do not contain any changes to
documentation that would explain it and I'm not familiar with what the
feature is supposed to do. Thus my comments will be purely for the code
itself and a further review will be required.
Re: [RFC: vf-token 0/5] Introduce vf-token when using userspace PF
Posted by Vivek Kashyap 6 months, 4 weeks ago

On Fri, 6 Oct 2023, Peter Krempa wrote:

...
>
> This is mostly because the patches do not contain any changes to
> documentation that would explain it and I'm not familiar with what the
> feature is supposed to do. Thus my comments will be purely for the code
> itself and a further review will be required.
>
>

Thanks! I've gone over your comments on the patches and will repost next week
with the fixes and include documentation and tests.

-vk