Re: [libvirt PATCH v2 00/15] Support for VFIO variant drivers, Part 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ping

On 11/6/23 2:38 AM, Laine Stump wrote:
(Thisis "V2 of Part 2". "V1 of Part 2" is here:
https://lists.libvirt.org/archives/list/devel@xxxxxxxxxxxxxxxxx/thread/5GF4N5D2HR37HIST3QZ6GXZ6CLIEWOVN/#5GF4N5D2HR37HIST3QZ6GXZ6CLIEWOVN )

Part 1 (which simply made it possible to use virsh nodedev-detach to
bind a device to a manually-specified variant driver, and at guest
runtime allowed libvirt to ignore the fact that the driver found to
the device was something other than exactly "vfio-pci") was here:

https://listman.redhat.com/archives/libvir-list/2023-August/241338.html

and pushed upstream as of commit v9.6.0-153-g24beaffec3

Part 2 adds two new pieces of functionality:

1) It is possible to manually specify a VFIO variant driver (or force
    the generic vfio-pci driver) for a device in the domain XML with,
    e.g.:

       <driver name='mlx5_vfio_pci'/>

    (for the former) or:

       <driver name='vfio-pci'/>

(for the latter).

2) By default libvirt will now find the "best match" VFIO or VFIO
    variant driver by comparing the device's modalias file contents (in
    sysfs) with vfio drivers found in the running kernel's
    modules.alias file. This means that "virsh nodedev-detach" of a
    host device will bind it to its appropriate VFIO variant driver (if
    one is available), and also if a <hostdev> decice in a domain
    config has "managed='yes'", libvirt will bind it to a variant
    driver if possible (in order to force binding to the basic vfio-pci
    driver instead, you just need to add the <driver> element mentioned
    above).

The first 12 patches are all just getting (1) going (a lot of it is
refactoring code to use common code for the four places that use the
hostdev <driver> element), and the final 3 patches implement (2).

More details are spread along the way.

Differences from V1:

I squashed together a couple of the patches, and fixed some things that caused
CI jobs to fail (I'd forgotten to push the branch to gitlab and
trigger CI).

Laine Stump (15):
   util: properly deal with module vs. driver when binding device to
     driver
   schema: consolidate RNG for all hostdev <driver> elements
   conf: move/rename hostdev PCI driver type enum to device_conf.h
   conf: normalize hostdev <driver> parsing to simplify adding new attr
   conf: put hostdev PCI backend into a struct
   conf: use virDeviceHostdevPCIDriverInfo in network and networkport
     objects
   conf: split out hostdev <driver> parse/format to their own functions
   conf: use new common parser/formatter for hostdev driver in network
     XML
   tests: remove explicit <driver name='vfio'/> from hostdev test cases
   xen: explicitly set hostdev driver.type at runtime, not in postparse
   conf: replace virHostdevIsVFIODevice with virHostdevIsPCIDevice
   conf: support manually specifying VFIO variant driver in <hostdev> XML
   util: new function virStringSkipToSpace()
   tests: mock virPCIDevice(BindTo|UnbindFrom)Stub with nop functions
   qemu: automatically bind to a vfio variant driver, if available

  docs/formatdomain.rst                         |  55 ++-
  src/conf/device_conf.c                        |  75 +++
  src/conf/device_conf.h                        |  27 ++
  src/conf/domain_capabilities.c                |   2 +-
  src/conf/domain_capabilities.h                |   2 +-
  src/conf/domain_conf.c                        |  98 +---
  src/conf/domain_conf.h                        |  18 +-
  src/conf/network_conf.c                       |  43 +-
  src/conf/network_conf.h                       |  17 +-
  src/conf/schemas/basictypes.rng               |  20 +
  src/conf/schemas/domaincommon.rng             | 173 ++++---
  src/conf/schemas/network.rng                  |  10 +-
  src/conf/schemas/networkport.rng              |  10 +-
  src/conf/virconftypes.h                       |   2 +
  src/conf/virnetworkportdef.c                  |  22 +-
  src/conf/virnetworkportdef.h                  |   4 +-
  src/hypervisor/virhostdev.c                   |  16 +-
  src/hypervisor/virhostdev.h                   |   2 -
  src/libvirt_private.syms                      |  10 +-
  src/libxl/libxl_capabilities.c                |   2 +-
  src/libxl/libxl_domain.c                      |  65 ++-
  src/libxl/libxl_driver.c                      |  25 +-
  src/network/bridge_driver.c                   |   2 +-
  src/qemu/qemu_capabilities.c                  |   4 +-
  src/qemu/qemu_command.c                       |  14 +-
  src/qemu/qemu_domain.c                        |  29 +-
  src/qemu/qemu_hostdev.c                       |   2 +-
  src/qemu/qemu_hotplug.c                       |   2 +-
  src/qemu/qemu_validate.c                      |   6 +-
  src/security/security_apparmor.c              |   2 +-
  src/security/security_dac.c                   |   4 +-
  src/security/security_selinux.c               |   4 +-
  src/security/virt-aa-helper.c                 |   8 +-
  src/util/virpci.c                             | 438 ++++++++++++++++--
  src/util/virpci.h                             |   3 +
  src/util/virstring.c                          |  17 +
  src/util/virstring.h                          |   1 +
  tests/domaincapstest.c                        |   4 +-
  tests/libxlxml2domconfigdata/moredevs-hvm.xml |   1 -
  tests/networkxml2xmlin/hostdev-pf-old.xml     |   8 +
  tests/networkxml2xmlin/hostdev-pf.xml         |   2 +-
  tests/networkxml2xmlout/hostdev-pf-old.xml    |   8 +
  tests/networkxml2xmlout/hostdev-pf.xml        |   2 +-
  tests/networkxml2xmltest.c                    |   6 +
  tests/qemuhotplugmock.c                       |  15 +
  .../qemuhotplug-hostdev-pci.xml               |   1 -
  .../qemuhotplug-base-live+hostdev-pci.xml     |   2 +-
  ...uhotplug-pseries-base-live+hostdev-pci.xml |   2 +-
  tests/qemustatusxml2xmldata/modern-in.xml     |   2 +-
  .../hostdev-pci-address-unassigned.xml        |   4 -
  .../hostdev-pci-multifunction.xml             |   7 -
  .../hostdev-vfio-multidomain.xml              |   1 -
  .../hostdev-vfio-zpci-autogenerate-fids.xml   |   2 -
  .../hostdev-vfio-zpci-autogenerate-uids.xml   |   2 -
  .../hostdev-vfio-zpci-autogenerate.xml        |   1 -
  .../hostdev-vfio-zpci-boundaries.xml          |   2 -
  .../hostdev-vfio-zpci-ccw-memballoon.xml      |   1 -
  .../hostdev-vfio-zpci-duplicate.xml           |   2 -
  ...ostdev-vfio-zpci-invalid-uid-valid-fid.xml |   1 -
  .../hostdev-vfio-zpci-multidomain-many.xml    |   8 -
  .../hostdev-vfio-zpci-set-zero.xml            |   1 -
  .../hostdev-vfio-zpci-uid-set-zero.xml        |   1 -
  .../hostdev-vfio-zpci-wrong-arch.xml          |   1 -
  tests/qemuxml2argvdata/hostdev-vfio-zpci.xml  |   1 -
  .../hostdev-vfio.x86_64-latest.args           |   5 +-
  tests/qemuxml2argvdata/hostdev-vfio.xml       |  19 +-
  .../net-hostdev-vfio-multidomain.xml          |   1 -
  tests/qemuxml2argvdata/net-hostdev-vfio.xml   |   1 -
  tests/qemuxml2argvdata/pseries-hostdevs-1.xml |   3 -
  tests/qemuxml2argvdata/pseries-hostdevs-2.xml |   2 -
  tests/qemuxml2argvdata/pseries-hostdevs-3.xml |   2 -
  ...v-pci-address-unassigned.x86_64-latest.xml |   4 -
  ...ostdev-pci-multifunction.x86_64-latest.xml |   7 -
  ...io-zpci-autogenerate-fids.s390x-latest.xml |   2 -
  ...io-zpci-autogenerate-uids.s390x-latest.xml |   2 -
  ...ev-vfio-zpci-autogenerate.s390x-latest.xml |   1 -
  ...tdev-vfio-zpci-boundaries.s390x-latest.xml |   2 -
  ...-vfio-zpci-ccw-memballoon.s390x-latest.xml |   1 -
  ...fio-zpci-multidomain-many.s390x-latest.xml |   8 -
  .../hostdev-vfio-zpci.s390x-latest.xml        |   1 -
  .../hostdev-vfio.x86_64-latest.xml            |  24 +-
  .../net-hostdev-vfio.x86_64-latest.xml        |   1 -
  .../pseries-hostdevs-1.ppc64-latest.xml       |   3 -
  .../pseries-hostdevs-2.ppc64-latest.xml       |   2 -
  .../pseries-hostdevs-3.ppc64-latest.xml       |   2 -
  tests/virhostdevtest.c                        |   2 +-
  .../plug-hostdev-pci-unmanaged.xml            |   2 +-
  .../plug-hostdev-pci.xml                      |   2 +-
  tests/xlconfigdata/test-fullvirt-pci.xml      |   2 -
  tests/xmconfigdata/test-pci-dev-syntax.xml    |   2 -
  tests/xmconfigdata/test-pci-devs.xml          |   2 -
  tools/virsh-completer-nodedev.c               |   4 +-
  92 files changed, 933 insertions(+), 498 deletions(-)
  create mode 100644 tests/networkxml2xmlin/hostdev-pf-old.xml
  create mode 100644 tests/networkxml2xmlout/hostdev-pf-old.xml

_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux