Hi,
This is a follow up to the third RFC patchset [0] for supporting multiple
vSMMU instances.
This patchset implements support for specifying multiple <iommu> devices
within the VM definition when smmuv3Dev IOMMU model is specified, 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='smmuv3Dev' parentIdx='0'/>
<iommu model='smmuv3Dev' parentIdx='1'/>
</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"}' \
Nathan Chen (4):
qemu: add IOMMU model smmuv3Dev
conf: Support multiple smmuv3Dev IOMMU devices
tests: qemuxmlconfdata: provide smmuv3Dev sample XML and CLI args
cover letter: qemu: Implement support for multiple SMMUv3s
docs/formatdomain.rst | 9 +-
src/conf/domain_conf.c | 102 +++++++--
src/conf/domain_conf.h | 11 +-
src/conf/domain_validate.c | 49 ++++-
src/conf/schemas/domaincommon.rng | 10 +-
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 15 +-
src/qemu/qemu_command.c | 202 ++++++++++++------
src/qemu/qemu_domain_address.c | 33 +--
src/qemu/qemu_driver.c | 8 +-
src/qemu/qemu_postparse.c | 11 +-
src/qemu/qemu_validate.c | 18 +-
.../iommu-smmuv3Dev.aarch64-latest.args | 39 ++++
.../iommu-smmuv3Dev.aarch64-latest.xml | 62 ++++++
tests/qemuxmlconfdata/iommu-smmuv3Dev.xml | 49 +++++
tests/qemuxmlconftest.c | 1 +
16 files changed, 492 insertions(+), 129 deletions(-)
create mode 100644 tests/qemuxmlconfdata/iommu-smmuv3Dev.aarch64-latest.args
create mode 100644 tests/qemuxmlconfdata/iommu-smmuv3Dev.aarch64-latest.xml
create mode 100644 tests/qemuxmlconfdata/iommu-smmuv3Dev.xml
--
2.43.0