Hi,
This is a follow up to the second patchset [0] for supporting multiple
device-pluggable vSMMU instances.
This patchset implements support for specifying multiple <iommu> devices
within the VM definition when smmuv3 IOMMU model is specified with
a pciBus driver attribute, and is tested with Shameer's recently accepted
qemu series for user-creatable vSMMU devices [1]
For instance, specifying the associated emulated device in a
VM definition with multiple IOMMUs, configured to be routed to
pcie-expander-bus or pcie-root controllers:
<devices>
<controller type='pci' index='0' model='pcie-root'/>
<controller type='pci' index='1' model='pcie-expander-bus'>
<model name='pxb-pcie'/>
<target busNr='252'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</controller>
<controller type='pci' index='2' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='2' port='0x0'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</controller>
...
<rng model='virtio'>
<backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
</rng>
<rng model='virtio'>
<backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</rng>
<iommu model='smmuv3'>
<driver pciBus='0'/>
</iommu>
<iommu model='smmuv3'>
<driver pciBus='1'/>
</iommu>
</devices>
This would get translated to a qemu command line with the arguments below.
-device '{"driver":"pxb-pcie","bus_nr":252,"id":"pci.1","bus":"pcie.0","addr":"0x1"}' \
-device '{"driver":"pcie-root-port","port":0,"chassis":2,"id":"pci.2","bus":"pci.1","addr":"0x0"}' \
-device '{"driver":"arm-smmuv3","primary-bus":"pcie.0","id":"smmuv3.0"}' \
-device '{"driver":"arm-smmuv3","primary-bus":"pci.1","id":"smmuv3.1"}' \
...
-object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/urandom"}' \
-device '{"driver":"virtio-rng-pci","rng":"objrng0","id":"rng0","bus":"pci.2","addr":"0x0"}' \
-object '{"qom-type":"rng-random","id":"objrng1","filename":"/dev/urandom"}' \
-device '{"driver":"virtio-rng-pci","rng":"objrng1","id":"rng1","bus":"pcie.0","addr":"0x4"}' \
Changes from v2:
- Make multi-iommu adoption the first commit
- Consolidate smmuv3Dev into smmuv3 model
- Change 'parentIdx' attribute name to 'pciBus'
- Change naming of virDomainDef 'iommu' attribute to 'iommus'
- Move multi-iommu check to validation code
- Move qemu dev props function to device-pluggable smmuv3 commit
- Fix conditional statements per feedback
Changes from v1:
- Moved parentIdx attribute under <driver>
- Revised qemuxmlconfdata test cases to attach emulated devices
This series is on Github:
https://github.com/NathanChenNVIDIA/libvirt/tree/nestedsmmuv3-no-accel-10-21-25
Thanks,
Nathan
[0] https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/IF6OSSM22AHJU2X7D4MKW2QPPBZZCEVL/
[1] https://lore.kernel.org/qemu-devel/20250829082543.7680-1-skolothumtho@nvidia.com/
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Nathan Chen (3):
conf: Support multiple device-pluggable smmuv3 IOMMUs
qemu: Implement pluggable-device smmuv3
tests: qemuxmlconfdata: provide device-pluggable smmuv3 sample XML and
CLI args
docs/formatdomain.rst | 4 +
src/conf/domain_conf.c | 100 +++++++--
src/conf/domain_conf.h | 10 +-
src/conf/domain_validate.c | 61 ++++--
src/conf/schemas/domaincommon.rng | 9 +-
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 15 +-
src/qemu/qemu_command.c | 197 ++++++++++++------
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_domain_address.c | 5 +-
src/qemu/qemu_driver.c | 8 +-
src/qemu/qemu_postparse.c | 11 +-
src/qemu/qemu_validate.c | 2 +-
.../iommu-smmuv3-pci-bus.aarch64-latest.args | 41 ++++
.../iommu-smmuv3-pci-bus.aarch64-latest.xml | 62 ++++++
.../qemuxmlconfdata/iommu-smmuv3-pci-bus.xml | 49 +++++
tests/qemuxmlconftest.c | 1 +
17 files changed, 455 insertions(+), 124 deletions(-)
create mode 100644 tests/qemuxmlconfdata/iommu-smmuv3-pci-bus.aarch64-latest.args
create mode 100644 tests/qemuxmlconfdata/iommu-smmuv3-pci-bus.aarch64-latest.xml
create mode 100644 tests/qemuxmlconfdata/iommu-smmuv3-pci-bus.xml
--
2.43.0