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

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

 



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.

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()
  util: new function virPCIDeviceFindBestVFIOVariant()
  qemu: automatically bind to a vfio variant driver, if available

 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                       |  44 +-
 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                  |  23 +-
 src/conf/virnetworkportdef.h                  |   4 +-
 src/hypervisor/virhostdev.c                   |  16 +-
 src/hypervisor/virhostdev.h                   |   2 -
 src/libvirt_private.syms                      |   8 +-
 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                             | 434 ++++++++++++++++--
 src/util/virpci.h                             |   2 +
 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 +
 .../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 +-
 90 files changed, 875 insertions(+), 481 deletions(-)
 create mode 100644 tests/networkxml2xmlin/hostdev-pf-old.xml
 create mode 100644 tests/networkxml2xmlout/hostdev-pf-old.xml

-- 
2.41.0




[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