With all supported qemu versions we'll pick PCIe to use for the implicit
address busses (those lacking an explicit controller) and thus the
addresses must reflect that.
Update the test to add the new flags, and fix the addresses.
Additionally add a real-caps version of the test.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
...o-pci-manual-addresses.aarch64-latest.args | 49 ++++++++++++
.../aarch64-virtio-pci-manual-addresses.args | 10 ++-
.../aarch64-virtio-pci-manual-addresses.xml | 4 +-
tests/qemuxml2argvtest.c | 4 +
...io-pci-manual-addresses.aarch64-latest.xml | 75 +++++++++++++++++++
.../aarch64-virtio-pci-manual-addresses.xml | 24 ++++--
tests/qemuxml2xmltest.c | 4 +
7 files changed, 157 insertions(+), 13 deletions(-)
create mode 100644
tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.args
create mode 100644
tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.xml
diff --git
a/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.args
b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.args
new file mode 100644
index 0000000000..dcf5d187fa
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.args
@@ -0,0 +1,49 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-aarch64test \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
+/usr/bin/qemu-system-aarch64 \
+-name guest=aarch64test,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-aarch64test/master-key.aes"}'
\
+-machine virt,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram \
+-accel tcg \
+-cpu cortex-a53 \
+-m 1024 \
+-object
'{"qom-type":"memory-backend-ram","id":"mach-virt.ram","size":1073741824}'
\
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-kernel /aarch64.kernel \
+-initrd /aarch64.initrd \
+-append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
+-dtb /aarch64.dtb \
+-device
'{"driver":"i82801b11-bridge","id":"pci.1","bus":"pcie.0","addr":"0x1"}'
\
+-device
'{"driver":"pci-bridge","chassis_nr":2,"id":"pci.2","bus":"pci.1","addr":"0x0"}'
\
+-device
'{"driver":"pcie-root-port","port":16,"chassis":3,"id":"pci.3","bus":"pcie.0","multifunction":true,"addr":"0x2"}'
\
+-device
'{"driver":"pcie-root-port","port":17,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x1"}'
\
+-device
'{"driver":"pcie-root-port","port":18,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x2"}'
\
+-device
'{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.4","addr":"0x0"}'
\
+-blockdev
'{"driver":"file","filename":"/aarch64.raw","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
\
+-device
'{"driver":"scsi-hd","bus":"scsi0.0","channel":0,"scsi-id":0,"lun":0,"device_id":"drive-scsi0-0-0-0","drive":"libvirt-1-format","id":"scsi0-0-0-0","bootindex":1}'
\
+-netdev user,id=hostnet0 \
+-device
'{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:09:a4:37","bus":"pci.3","addr":"0x0"}'
\
+-netdev user,id=hostnet1 \
+-device
'{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"52:54:00:09:a4:38","bus":"pci.5","addr":"0x0"}'
\
+-audiodev
'{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args
b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args
index 65c2b3b706..bdc5e7b798 100644
--- a/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args
+++ b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.args
@@ -32,14 +32,16 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
-dtb /aarch64.dtb \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
--device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.1,addr=0x1 \
--device virtio-scsi-pci,id=scsi0,bus=pci.3,addr=0x1 \
+-device pcie-root-port,port=16,chassis=3,id=pci.3,bus=pcie.0,multifunction=on,addr=0x2 \
+-device pcie-root-port,port=17,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x1 \
+-device pcie-root-port,port=18,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x2 \
+-device virtio-scsi-pci,id=scsi0,bus=pci.4,addr=0x0 \
-blockdev
'{"driver":"file","filename":"/aarch64.raw","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
\
-device
scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,device_id=drive-scsi0-0-0-0,drive=libvirt-1-format,id=scsi0-0-0-0,bootindex=1
\
-netdev user,id=hostnet0 \
--device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:09:a4:37,bus=pci.3,addr=0x2
\
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:09:a4:37,bus=pci.3,addr=0x0
\
-netdev user,id=hostnet1 \
--device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:09:a4:38,bus=pci.2,addr=0x1
\
+-device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:09:a4:38,bus=pci.5,addr=0x0
\
-audiodev
'{"id":"audio1","driver":"none"}' \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.xml
b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.xml
index fee32588f7..d1c3ccc70e 100644
--- a/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.xml
+++ b/tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.xml
@@ -41,12 +41,12 @@
<address type='pci' domain='0x0000' bus='0x01'
slot='0x00' function='0x0'/>
</controller>
<controller type='scsi' index='0' model='virtio-scsi'>
- <address type='pci' domain='0x0000' bus='0x03'
slot='0x01' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x04'
slot='0x00' function='0x0'/>
</controller>
<interface type='user'>
<mac address='52:54:00:09:a4:37'/>
<model type='virtio'/>
- <address type='pci' domain='0x0000' bus='0x03'
slot='0x02' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x03'
slot='0x00' function='0x0'/>
</interface>
<interface type='user'>
<mac address='52:54:00:09:a4:38'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index faa5077112..7b2ae88658 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2358,11 +2358,15 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("aarch64-virtio-pci-default",
"aarch64");
/* Example of using virtio-pci with no explicit PCI controller
but with manual PCI addresses */
+ DO_TEST_CAPS_ARCH_LATEST("aarch64-virtio-pci-manual-addresses",
"aarch64");
DO_TEST("aarch64-virtio-pci-manual-addresses",
QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+ QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
+ QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL,
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("aarch64-video-virtio-gpu-pci",
diff --git
a/tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.xml
b/tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.xml
new file mode 100644
index 0000000000..63c2636f5e
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.xml
@@ -0,0 +1,75 @@
+<domain type='qemu'>
+ <name>aarch64test</name>
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='aarch64' machine='virt'>hvm</type>
+ <kernel>/aarch64.kernel</kernel>
+ <initrd>/aarch64.initrd</initrd>
+ <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda
rootwait</cmdline>
+ <dtb>/aarch64.dtb</dtb>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <apic/>
+ <pae/>
+ <gic version='2'/>
+ </features>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='allow'>cortex-a53</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source file='/aarch64.raw'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1'
model='dmi-to-pci-bridge'>
+ <model name='i82801b11-bridge'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x0'/>
+ </controller>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='2'/>
+ <address type='pci' domain='0x0000' bus='0x01'
slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <address type='pci' domain='0x0000' bus='0x04'
slot='0x00' function='0x0'/>
+ </controller>
+ <controller type='pci' index='3'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='3' port='0x10'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='pci' index='4'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='4' port='0x11'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x1'/>
+ </controller>
+ <controller type='pci' index='5'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='5' port='0x12'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x2'/>
+ </controller>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x03'
slot='0x00' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:38'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x05'
slot='0x00' function='0x0'/>
+ </interface>
+ <audio id='1' type='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.xml
b/tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.xml
index 7c90f21f39..63c2636f5e 100644
--- a/tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-virtio-pci-manual-addresses.xml
@@ -43,22 +43,32 @@
<address type='pci' domain='0x0000' bus='0x01'
slot='0x00' function='0x0'/>
</controller>
<controller type='scsi' index='0' model='virtio-scsi'>
- <address type='pci' domain='0x0000' bus='0x03'
slot='0x01' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x04'
slot='0x00' function='0x0'/>
</controller>
- <controller type='pci' index='3' model='pci-bridge'>
- <model name='pci-bridge'/>
- <target chassisNr='3'/>
- <address type='pci' domain='0x0000' bus='0x01'
slot='0x01' function='0x0'/>
+ <controller type='pci' index='3'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='3' port='0x10'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0' multifunction='on'/>
+ </controller>
+ <controller type='pci' index='4'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='4' port='0x11'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x1'/>
+ </controller>
+ <controller type='pci' index='5'
model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='5' port='0x12'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x2'/>
</controller>
<interface type='user'>
<mac address='52:54:00:09:a4:37'/>
<model type='virtio'/>
- <address type='pci' domain='0x0000' bus='0x03'
slot='0x02' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x03'
slot='0x00' function='0x0'/>
</interface>
<interface type='user'>
<mac address='52:54:00:09:a4:38'/>
<model type='virtio'/>
- <address type='pci' domain='0x0000' bus='0x02'
slot='0x01' function='0x0'/>
+ <address type='pci' domain='0x0000' bus='0x05'
slot='0x00' function='0x0'/>
</interface>
<audio id='1' type='none'/>
</devices>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index a8a6cd6ca7..328f8cba6a 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -935,11 +935,15 @@ mymain(void)
QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
DO_TEST_CAPS_ARCH_LATEST("aarch64-virtio-pci-default",
"aarch64");
+ DO_TEST_CAPS_ARCH_LATEST("aarch64-virtio-pci-manual-addresses",
"aarch64");
DO_TEST("aarch64-virtio-pci-manual-addresses",
QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM,
QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+ QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
+ QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL,
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("aarch64-video-virtio-gpu-pci",
--
2.39.2