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:
v3:
- merge qemu patch into conf patch (Peter Krempa)
- fix pasid_bits type definition (Peter Krempa)
- fix doc to use 'pasid_bits' rather than 'pasid-bits' (Peter Krempa)
- add patch10 to print attribute name in error message (Peter Krempa)
- add patch5 for missing validations
v2:
- Added support for 'pasid_bits' and 'svm' attributes.
- rebased to master branch newest
Thanks,
Zhenzhong
Zhenzhong Duan (10):
qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_SCALABLE_MODE
qemu: Add scalable_mode attribute to iommu
qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_FSTS
qemu: Add fsts attribute to iommu
qemu: Validate PCI hostdev assignment against intel-iommu 'fsts'
qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_PASID_BITS
qemu: add pasid_bits attribute to iommu
qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_SVM
qemu: add svm attribute to iommu
conf: qemu: Standardize IOMMU error messages to use XML attribute
names
docs/formatdomain.rst | 19 +++
src/conf/domain_conf.c | 120 +++++++++++++++---
src/conf/domain_conf.h | 7 +
src/conf/domain_validate.c | 55 +++++++-
src/conf/schemas/domaincommon.rng | 20 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 10 ++
src/qemu/qemu_capabilities.h | 6 +
src/qemu/qemu_command.c | 4 +
src/qemu/qemu_validate.c | 59 +++++++--
.../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 +
26 files changed, 712 insertions(+), 31 deletions(-)
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