An 'ats' OnOffAuto property was introduced for QEMU vfio-pci devices in
QEMU v11.0 [0]. This property controls whether the ATS capability is
exposed in a device's PCIe config space. 'off' always masks the
capability, 'on' fails device realize if the kernel reports it is
unsupported for the device, and the default 'auto' value masks it if
the kernel reports it is unsupported.

This series exposes the property as an attribute of the hostdev
<driver> element:

  <hostdev mode='subsystem' type='pci' managed='yes'>
    <driver name='vfio' ats='off'/>
    ...
  </hostdev>

If the attribute is omitted, nothing is passed to QEMU and its 'auto'
default applies.

The attribute is rejected in network and network port <driver>
definitions, as ATS visibility is a per-VM decision and network <driver>
settings other than name/model do not apply. Users can still set the
attribute for individual VFs through <interface type='hostdev'>.

[0] https://github.com/qemu/qemu/commit/bc034e8a959c07471d1214b3525bb68fccce1031

Nathan Chen (2):
  qemu: capabilities: Introduce QEMU_CAPS_VFIO_PCI_ATS
  qemu: Support vfio-pci per-device ATS attribute

 docs/formatdomain.rst                         |  8 +++
 src/conf/device_conf.c                        |  8 +++
 src/conf/device_conf.h                        |  1 +
 src/conf/network_conf.c                       |  6 +++
 src/conf/schemas/basictypes.rng               |  5 ++
 src/conf/virnetworkportdef.c                  |  6 +++
 src/qemu/qemu_capabilities.c                  |  2 +
 src/qemu/qemu_capabilities.h                  |  1 +
 src/qemu/qemu_command.c                       |  1 +
 src/qemu/qemu_validate.c                      |  7 +++
 .../caps_11.1.0_aarch64.xml                   |  1 +
 .../caps_11.1.0_s390x.xml                     |  1 +
 .../caps_11.1.0_x86_64.xml                    |  1 +
 .../caps_11.2.0_aarch64.xml                   |  1 +
 .../caps_11.2.0_s390x.xml                     |  1 +
 .../caps_11.2.0_x86_64.xml                    |  1 +
 .../hostdev-vfio-ats.x86_64-latest.args       | 36 +++++++++++++
 .../hostdev-vfio-ats.x86_64-latest.xml        | 52 +++++++++++++++++++
 tests/qemuxmlconfdata/hostdev-vfio-ats.xml    | 41 +++++++++++++++
 tests/qemuxmlconftest.c                       |  1 +
 20 files changed, 181 insertions(+)
 create mode 100644 tests/qemuxmlconfdata/hostdev-vfio-ats.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/hostdev-vfio-ats.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/hostdev-vfio-ats.xml

-- 
2.43.0

Reply via email to