diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-generic.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-generic.args new file mode 100644 index 0000000000000000000000000000000000000000..96239bd3134d5e26f550f5494034d5f519a10fd8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-generic.args @@ -0,0 +1,22 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest \ +-S \ +-M q35 \ +-m 2048 \ +-smp 2,sockets=2,cores=1,threads=1 \ +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-guest/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-device pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,\ +multifunction=on,addr=0x2 \ +-device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \ +-device ioh3420,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-generic.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-generic.xml new file mode 100644 index 0000000000000000000000000000000000000000..7acfb95c686709b89838f0f9e42d02d576ff8808 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-generic.xml @@ -0,0 +1,22 @@ + + guest + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-ioh3420.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-ioh3420.args new file mode 100644 index 0000000000000000000000000000000000000000..73f533bd007983941e75bbf5c5957466f5b04ba9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-ioh3420.args @@ -0,0 +1,21 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest \ +-S \ +-M q35 \ +-m 2048 \ +-smp 2,sockets=2,cores=1,threads=1 \ +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-guest/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-device ioh3420,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ +addr=0x2 \ +-device ioh3420,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-ioh3420.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-ioh3420.xml new file mode 100644 index 0000000000000000000000000000000000000000..4cba3f954ec044d0f9f93d8ff0cafdc5b5363e61 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-model-ioh3420.xml @@ -0,0 +1,19 @@ + + guest + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5716509befa9b8c0a08ea368494f990005d06a9f..4a661367f4a740457414e17fe43747ab9f66555d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2011,12 +2011,26 @@ mymain(void) QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_USB_REDIR); + + /* Test automatic and manual setting of pcie-root-port attributes */ DO_TEST("pcie-root-port", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_QXL); + + /* Make sure the default model for PCIe Root Ports is picked correctly + * based on QEMU binary capabilities. We use x86/q35 for the test, but + * any PCIe machine type (such as aarch64/virt) will behave the same */ + DO_TEST("pcie-root-port-model-generic", + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_PCI_MULTIFUNCTION); + DO_TEST("pcie-root-port-model-ioh3420", + QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_PCI_MULTIFUNCTION); + DO_TEST("autoindex", QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-model-generic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-model-generic.xml new file mode 100644 index 0000000000000000000000000000000000000000..0de0d3e276f318b533bf37b1d1f08fcd6ce05e7b --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-model-generic.xml @@ -0,0 +1,40 @@ + + guest + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + +
+ + + + +
+ + +
+ + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-model-ioh3420.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-model-ioh3420.xml new file mode 100644 index 0000000000000000000000000000000000000000..3bbecf7b69cb4c0ed78ebf162feaeb793081c795 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-model-ioh3420.xml @@ -0,0 +1,35 @@ + + guest + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + +
+ + +
+ + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index bf62dbbb26820c613d18511802026ffb7ecf3e82..7199175633ae161867998e443ae7dc53638802c0 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -884,12 +884,26 @@ mymain(void) QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_QXL); + + /* Test automatic and manual setting of pcie-root-port attributes */ DO_TEST("pcie-root-port", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_QXL); + + /* Make sure the default model for PCIe Root Ports is picked correctly + * based on QEMU binary capabilities. We use x86/q35 for the test, but + * any PCIe machine type (such as aarch64/virt) will behave the same */ + DO_TEST("pcie-root-port-model-generic", + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_PCI_MULTIFUNCTION); + DO_TEST("pcie-root-port-model-ioh3420", + QEMU_CAPS_DEVICE_IOH3420, + QEMU_CAPS_PCI_MULTIFUNCTION); + DO_TEST("pcie-switch-upstream-port", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_DEVICE_X3130_UPSTREAM,