Hi,

This series adds support for configuring Intel vIOMMU (VT-d) in domain XML
and formatting them onto the QEMU command line:

  * scalable_mode: Configures scalable mode support ('on'/'off').
  * fsts: Enables First-Stage Translation support ('on'/'off').
  * pasid_bits: Sets the number of supported PASID bits.
  * svm: Enables Shared Virtual Memory (SVM) / PRQ support ('on'/'off').

With these attributes, users can configure advanced vIOMMU features for both
emulated devices and assigned host devices (e.g., vSVA / nested translation via
iommufd and first-stage translation).

Example domain XML configuration:

    <iommu model='intel'>
      <driver caching_mode='on' iotlb='on' scalable_mode='on' fsts='on' 
pasid_bits='6' svm='on'/>
    </iommu>

Which formats the following QEMU command line options:

    -device 
{"driver":"intel-iommu","id":"iommu0","caching-mode":true,"device-iotlb":true,"scalable-mode":true,"fsts":true,"pasid-bits":6,"svm":true}

Testing:
  - Validated with libvirt test suite (ninja test).
  - Tested DSA card passthrough and SVM/vSVA with iommufd backend.

Changelog:
v1:
- Added support for 'pasid_bits' and 'svm' attributes.
- rebased to master branch newest

Thanks,
Zhenzhong

Zhenzhong Duan (12):
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_SCALABLE_MODE
  conf: Add scalable_mode attribute to iommu
  qemu: format scalable-mode on intel-iommu command line
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_FSTS
  conf: Add fsts attribute to iommu
  qemu: format fsts on intel-iommu command line
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_PASID_BITS
  conf: add pasid_bits attribute to iommu
  qemu: format pasid-bits on intel-iommu command line
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_SVM
  conf: add svm attribute to iommu
  qemu: format svm on intel-iommu command line

 docs/formatdomain.rst                         | 19 ++++++
 src/conf/domain_conf.c                        | 64 +++++++++++++++++++
 src/conf/domain_conf.h                        |  4 ++
 src/conf/domain_validate.c                    | 12 ++++
 src/conf/schemas/domaincommon.rng             | 20 ++++++
 src/qemu/qemu_capabilities.c                  | 10 +++
 src/qemu/qemu_capabilities.h                  |  6 ++
 src/qemu/qemu_command.c                       |  4 ++
 src/qemu/qemu_validate.c                      | 31 ++++++++-
 .../caps_11.0.0_x86_64+sgx.xml                |  1 +
 .../caps_11.0.0_x86_64.xml                    |  1 +
 .../caps_11.1.0_x86_64.xml                    |  4 ++
 .../intel-iommu-fsts.x86_64-latest.args       | 34 ++++++++++
 .../intel-iommu-fsts.x86_64-latest.xml        | 37 +++++++++++
 tests/qemuxmlconfdata/intel-iommu-fsts.xml    | 37 +++++++++++
 .../intel-iommu-pasid-bits.x86_64-latest.args | 34 ++++++++++
 .../intel-iommu-pasid-bits.x86_64-latest.xml  | 37 +++++++++++
 .../intel-iommu-pasid-bits.xml                | 37 +++++++++++
 ...tel-iommu-scalable-mode.x86_64-latest.args | 34 ++++++++++
 ...ntel-iommu-scalable-mode.x86_64-latest.xml | 37 +++++++++++
 .../intel-iommu-scalable-mode.xml             | 37 +++++++++++
 .../intel-iommu-svm.x86_64-latest.args        | 34 ++++++++++
 .../intel-iommu-svm.x86_64-latest.xml         | 37 +++++++++++
 tests/qemuxmlconfdata/intel-iommu-svm.xml     | 37 +++++++++++
 tests/qemuxmlconftest.c                       |  4 ++
 25 files changed, 611 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-fsts.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-fsts.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-fsts.xml
 create mode 100644 
tests/qemuxmlconfdata/intel-iommu-pasid-bits.x86_64-latest.args
 create mode 100644 
tests/qemuxmlconfdata/intel-iommu-pasid-bits.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-pasid-bits.xml
 create mode 100644 
tests/qemuxmlconfdata/intel-iommu-scalable-mode.x86_64-latest.args
 create mode 100644 
tests/qemuxmlconfdata/intel-iommu-scalable-mode.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-scalable-mode.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.xml

-- 
2.52.0

Reply via email to