[libvirt] [PATCH 3/4] tests: Test generic PCIe Root Ports

Andrea Bolognani posted 4 patches 8 years, 11 months ago
There is a newer version of this series
[libvirt] [PATCH 3/4] tests: Test generic PCIe Root Ports
Posted by Andrea Bolognani 8 years, 11 months ago
We want pcie-root-ports to be used for aarch64/virt guests
when available in QEMU, but at the same time we need to
ensure that other machine type and hosts where QEMU releases
lacking the new device type are not affected.
---
 ...uxml2argv-pcie-root-port-mach-virt-generic.args | 22 +++++++++++++
 ...muxml2argv-pcie-root-port-mach-virt-generic.xml | 22 +++++++++++++
 ...uxml2argv-pcie-root-port-mach-virt-ioh3420.args | 21 ++++++++++++
 ...muxml2argv-pcie-root-port-mach-virt-ioh3420.xml | 19 +++++++++++
 ...t.args => qemuxml2argv-pcie-root-port-q35.args} |  7 ++--
 .../qemuxml2argv-pcie-root-port-q35.xml            | 23 +++++++++++++
 .../qemuxml2argv-pcie-root-port.xml                | 36 --------------------
 tests/qemuxml2argvtest.c                           | 27 ++++++++++++---
 ...xml2xmlout-pcie-root-port-mach-virt-generic.xml | 38 ++++++++++++++++++++++
 ...xml2xmlout-pcie-root-port-mach-virt-ioh3420.xml | 33 +++++++++++++++++++
 ...t.xml => qemuxml2xmlout-pcie-root-port-q35.xml} | 19 +++++------
 tests/qemuxml2xmltest.c                            | 22 ++++++++++---
 12 files changed, 227 insertions(+), 62 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml
 rename tests/qemuxml2argvdata/{qemuxml2argv-pcie-root-port.args => qemuxml2argv-pcie-root-port-q35.args} (59%)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml
 delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml
 rename tests/qemuxml2xmloutdata/{qemuxml2xmlout-pcie-root-port.xml => qemuxml2xmlout-pcie-root-port-q35.xml} (71%)

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args
new file mode 100644
index 0000000..b0ae8b2
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name mach-virt-test \
+-S \
+-M virt \
+-m 2048 \
+-smp 2,sockets=2,cores=1,threads=1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-mach-virt-test/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
+addr=0x1 \
+-device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml
new file mode 100644
index 0000000..950397a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml
@@ -0,0 +1,22 @@
+<domain type='qemu'>
+  <name>mach-virt-test</name>
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'/>
+    <controller type='pci' index='2' model='pcie-root-port'>
+      <model name='ioh3420'/>
+    </controller>
+    <controller type='pci' index='3' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args
new file mode 100644
index 0000000..a57cdfd
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args
@@ -0,0 +1,21 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name mach-virt-test \
+-S \
+-M virt \
+-m 2048 \
+-smp 2,sockets=2,cores=1,threads=1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-mach-virt-test/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
+addr=0x1 \
+-device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml
new file mode 100644
index 0000000..897547b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+  <name>mach-virt-test</name>
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'/>
+    <controller type='pci' index='2' model='pcie-root-port'>
+      <model name='ioh3420'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.args
similarity index 59%
rename from tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
rename to tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.args
index 4e852ff..2e9d8da 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.args
@@ -18,8 +18,5 @@ QEMU_AUDIO_DRV=none \
 -boot c \
 -device ioh3420,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
 addr=0x2 \
--device ioh3420,port=0x1a,chassis=40,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
--drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-sata0-0-0 \
--device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
--device qxl-vga,id=video0,ram_size=67108864,vram_size=33554432,bus=pcie.0,\
-addr=0x1
+-device ioh3420,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
+-device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml
new file mode 100644
index 0000000..1102919
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml
@@ -0,0 +1,23 @@
+<domain type='qemu'>
+  <name>q35-test</name>
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='x86_64' machine='q35'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'/>
+    <controller type='pci' index='2' model='pcie-root-port'>
+      <model name='ioh3420'/>
+    </controller>
+    <controller type='pci' index='3' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+    </controller>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml
deleted file mode 100644
index 7ecc4a6..0000000
--- a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<domain type='qemu'>
-  <name>q35-test</name>
-  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
-  <memory unit='KiB'>2097152</memory>
-  <currentMemory unit='KiB'>2097152</currentMemory>
-  <vcpu placement='static' cpuset='0-1'>2</vcpu>
-  <os>
-    <type arch='x86_64' machine='q35'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/libexec/qemu-kvm</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='sda' bus='sata'/>
-      <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='pcie-root-port'/>
-    <controller type='pci' index='2' model='pcie-root-port'>
-      <model name='ioh3420'/>
-      <target chassis='40' port='0x1a'/>
-    </controller>
-    <controller type='sata' index='0'/>
-    <input type='mouse' bus='ps2'/>
-    <input type='keyboard' bus='ps2'/>
-    <video>
-      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
-    </video>
-    <memballoon model='none'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 6bd7465..db4da95 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2011,12 +2011,15 @@ mymain(void)
             QEMU_CAPS_DEVICE_QXL,
             QEMU_CAPS_HDA_DUPLEX,
             QEMU_CAPS_USB_REDIR);
-    DO_TEST("pcie-root-port",
+
+    /* Make sure the default model for PCIe Root Ports is picked correctly
+     * according to architecture, machine type and binary capabilities; also
+     * make sure that the user can override the default */
+    DO_TEST("pcie-root-port-q35",
             QEMU_CAPS_DEVICE_IOH3420,
-            QEMU_CAPS_ICH9_AHCI,
-            QEMU_CAPS_PCI_MULTIFUNCTION,
-            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
-            QEMU_CAPS_DEVICE_QXL);
+            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+            QEMU_CAPS_PCI_MULTIFUNCTION);
+
     DO_TEST("autoindex",
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
@@ -2294,6 +2297,20 @@ mymain(void)
     DO_TEST_FAILURE("aarch64-kvm-32-on-64",
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_KVM);
+
+    /* Make sure the default model for PCIe Root Ports is picked correctly
+     * according to architecture, machine type and binary capabilities; also
+     * make sure that the user can override the default */
+    DO_TEST("pcie-root-port-mach-virt-generic",
+            QEMU_CAPS_OBJECT_GPEX,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+            QEMU_CAPS_PCI_MULTIFUNCTION);
+    DO_TEST("pcie-root-port-mach-virt-ioh3420",
+            QEMU_CAPS_OBJECT_GPEX,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_PCI_MULTIFUNCTION);
+
     qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
 
     DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml
new file mode 100644
index 0000000..0eabafd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml
@@ -0,0 +1,38 @@
+<domain type='qemu'>
+  <name>mach-virt-test</name>
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <gic version='2'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='1' port='0x8'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='pci' index='2' model='pcie-root-port'>
+      <model name='ioh3420'/>
+      <target chassis='2' port='0x9'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='pci' index='3' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='3' port='0xa'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml
new file mode 100644
index 0000000..6c80d2a
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml
@@ -0,0 +1,33 @@
+<domain type='qemu'>
+  <name>mach-virt-test</name>
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <gic version='2'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/libexec/qemu-kvm</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'>
+      <model name='ioh3420'/>
+      <target chassis='1' port='0x8'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='pci' index='2' model='pcie-root-port'>
+      <model name='ioh3420'/>
+      <target chassis='2' port='0x9'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-q35.xml
similarity index 71%
rename from tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
rename to tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-q35.xml
index 5775eb9..0e6bb98 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-q35.xml
@@ -3,7 +3,7 @@
   <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
   <memory unit='KiB'>2097152</memory>
   <currentMemory unit='KiB'>2097152</currentMemory>
-  <vcpu placement='static' cpuset='0-1'>2</vcpu>
+  <vcpu placement='static'>2</vcpu>
   <os>
     <type arch='x86_64' machine='q35'>hvm</type>
     <boot dev='hd'/>
@@ -14,11 +14,6 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/libexec/qemu-kvm</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='sda' bus='sata'/>
-      <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='pcie-root-port'>
       <model name='ioh3420'/>
@@ -27,18 +22,20 @@
     </controller>
     <controller type='pci' index='2' model='pcie-root-port'>
       <model name='ioh3420'/>
-      <target chassis='40' port='0x1a'/>
+      <target chassis='2' port='0x11'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
     </controller>
+    <controller type='pci' index='3' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='3' port='0x12'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
+    </controller>
+    <controller type='usb' index='0' model='none'/>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
     </controller>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-    <video>
-      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
-    </video>
     <memballoon model='none'/>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 4353ad2..950d1c5 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -884,12 +884,24 @@ mymain(void)
             QEMU_CAPS_ICH9_AHCI,
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_DEVICE_QXL);
-    DO_TEST("pcie-root-port",
+
+    /* Make sure the default model for PCIe Root Ports is picked correctly
+     * according to architecture, machine type and binary capabilities; also
+     * make sure that the user can override the default */
+    DO_TEST("pcie-root-port-q35",
             QEMU_CAPS_DEVICE_IOH3420,
-            QEMU_CAPS_ICH9_AHCI,
-            QEMU_CAPS_PCI_MULTIFUNCTION,
-            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
-            QEMU_CAPS_DEVICE_QXL);
+            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+            QEMU_CAPS_PCI_MULTIFUNCTION);
+    DO_TEST("pcie-root-port-mach-virt-generic",
+            QEMU_CAPS_OBJECT_GPEX,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+            QEMU_CAPS_PCI_MULTIFUNCTION);
+    DO_TEST("pcie-root-port-mach-virt-ioh3420",
+            QEMU_CAPS_OBJECT_GPEX,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_PCI_MULTIFUNCTION);
+
     DO_TEST("pcie-switch-upstream-port",
             QEMU_CAPS_DEVICE_IOH3420,
             QEMU_CAPS_DEVICE_X3130_UPSTREAM,
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/4] tests: Test generic PCIe Root Ports
Posted by Laine Stump 8 years, 11 months ago
On 03/14/2017 12:58 PM, Andrea Bolognani wrote:
> We want pcie-root-ports to be used for aarch64/virt guests
> when available in QEMU, but at the same time we need to
> ensure that other machine type and hosts where QEMU releases
> lacking the new device type are not affected.
> ---
>  ...uxml2argv-pcie-root-port-mach-virt-generic.args | 22 +++++++++++++
>  ...muxml2argv-pcie-root-port-mach-virt-generic.xml | 22 +++++++++++++
>  ...uxml2argv-pcie-root-port-mach-virt-ioh3420.args | 21 ++++++++++++
>  ...muxml2argv-pcie-root-port-mach-virt-ioh3420.xml | 19 +++++++++++
>  ...t.args => qemuxml2argv-pcie-root-port-q35.args} |  7 ++--
>  .../qemuxml2argv-pcie-root-port-q35.xml            | 23 +++++++++++++
>  .../qemuxml2argv-pcie-root-port.xml                | 36 --------------------
>  tests/qemuxml2argvtest.c                           | 27 ++++++++++++---
>  ...xml2xmlout-pcie-root-port-mach-virt-generic.xml | 38 ++++++++++++++++++++++
>  ...xml2xmlout-pcie-root-port-mach-virt-ioh3420.xml | 33 +++++++++++++++++++
>  ...t.xml => qemuxml2xmlout-pcie-root-port-q35.xml} | 19 +++++------
>  tests/qemuxml2xmltest.c                            | 22 ++++++++++---
>  12 files changed, 227 insertions(+), 62 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml
>  rename tests/qemuxml2argvdata/{qemuxml2argv-pcie-root-port.args => qemuxml2argv-pcie-root-port-q35.args} (59%)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml
>  delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml
>  create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml
>  create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml
>  rename tests/qemuxml2xmloutdata/{qemuxml2xmlout-pcie-root-port.xml => qemuxml2xmlout-pcie-root-port-q35.xml} (71%)
> 
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args
> new file mode 100644
> index 0000000..b0ae8b2
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.args
> @@ -0,0 +1,22 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/libexec/qemu-kvm \
> +-name mach-virt-test \
> +-S \
> +-M virt \
> +-m 2048 \
> +-smp 2,sockets=2,cores=1,threads=1 \
> +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
> +-nographic \
> +-nodefaults \
> +-monitor unix:/tmp/lib/domain--1-mach-virt-test/monitor.sock,server,nowait \
> +-no-acpi \
> +-boot c \
> +-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
> +addr=0x1 \
> +-device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
> +-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml
> new file mode 100644
> index 0000000..950397a
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-generic.xml
> @@ -0,0 +1,22 @@
> +<domain type='qemu'>
> +  <name>mach-virt-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static'>2</vcpu>
> +  <os>
> +    <type arch='aarch64' machine='virt'>hvm</type>
> +  </os>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='pcie-root-port'/>
> +    <controller type='pci' index='2' model='pcie-root-port'>
> +      <model name='ioh3420'/>
> +    </controller>
> +    <controller type='pci' index='3' model='pcie-root-port'>
> +      <model name='pcie-root-port'/>
> +    </controller>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args
> new file mode 100644
> index 0000000..a57cdfd
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.args
> @@ -0,0 +1,21 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/libexec/qemu-kvm \
> +-name mach-virt-test \
> +-S \
> +-M virt \
> +-m 2048 \
> +-smp 2,sockets=2,cores=1,threads=1 \
> +-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
> +-nographic \
> +-nodefaults \
> +-monitor unix:/tmp/lib/domain--1-mach-virt-test/monitor.sock,server,nowait \
> +-no-acpi \
> +-boot c \
> +-device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
> +addr=0x1 \
> +-device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml
> new file mode 100644
> index 0000000..897547b
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-mach-virt-ioh3420.xml
> @@ -0,0 +1,19 @@
> +<domain type='qemu'>
> +  <name>mach-virt-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static'>2</vcpu>
> +  <os>
> +    <type arch='aarch64' machine='virt'>hvm</type>
> +  </os>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='pcie-root-port'/>
> +    <controller type='pci' index='2' model='pcie-root-port'>
> +      <model name='ioh3420'/>
> +    </controller>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.args
> similarity index 59%
> rename from tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
> rename to tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.args
> index 4e852ff..2e9d8da 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.args
> @@ -18,8 +18,5 @@ QEMU_AUDIO_DRV=none \
>  -boot c \
>  -device ioh3420,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
>  addr=0x2 \
> --device ioh3420,port=0x1a,chassis=40,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
> --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-sata0-0-0 \
> --device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
> --device qxl-vga,id=video0,ram_size=67108864,vram_size=33554432,bus=pcie.0,\
> -addr=0x1
> +-device ioh3420,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
> +-device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml
> new file mode 100644
> index 0000000..1102919
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port-q35.xml
> @@ -0,0 +1,23 @@
> +<domain type='qemu'>
> +  <name>q35-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static'>2</vcpu>
> +  <os>
> +    <type arch='x86_64' machine='q35'>hvm</type>
> +  </os>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='pcie-root-port'/>
> +    <controller type='pci' index='2' model='pcie-root-port'>
> +      <model name='ioh3420'/>
> +    </controller>
> +    <controller type='pci' index='3' model='pcie-root-port'>
> +      <model name='pcie-root-port'/>
> +    </controller>
> +    <controller type='usb' model='none'/>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml
> deleted file mode 100644
> index 7ecc4a6..0000000
> --- a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -<domain type='qemu'>
> -  <name>q35-test</name>
> -  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> -  <memory unit='KiB'>2097152</memory>
> -  <currentMemory unit='KiB'>2097152</currentMemory>
> -  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> -  <os>
> -    <type arch='x86_64' machine='q35'>hvm</type>
> -    <boot dev='hd'/>
> -  </os>
> -  <clock offset='utc'/>
> -  <on_poweroff>destroy</on_poweroff>
> -  <on_reboot>restart</on_reboot>
> -  <on_crash>destroy</on_crash>
> -  <devices>
> -    <emulator>/usr/libexec/qemu-kvm</emulator>
> -    <disk type='block' device='disk'>
> -      <source dev='/dev/HostVG/QEMUGuest1'/>
> -      <target dev='sda' bus='sata'/>
> -      <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='pcie-root-port'/>
> -    <controller type='pci' index='2' model='pcie-root-port'>
> -      <model name='ioh3420'/>
> -      <target chassis='40' port='0x1a'/>
> -    </controller>
> -    <controller type='sata' index='0'/>
> -    <input type='mouse' bus='ps2'/>
> -    <input type='keyboard' bus='ps2'/>
> -    <video>
> -      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
> -    </video>
> -    <memballoon model='none'/>
> -  </devices>
> -</domain>
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 6bd7465..db4da95 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -2011,12 +2011,15 @@ mymain(void)
>              QEMU_CAPS_DEVICE_QXL,
>              QEMU_CAPS_HDA_DUPLEX,
>              QEMU_CAPS_USB_REDIR);
> -    DO_TEST("pcie-root-port",
> +
> +    /* Make sure the default model for PCIe Root Ports is picked correctly
> +     * according to architecture, machine type and binary capabilities; also
> +     * make sure that the user can override the default */
> +    DO_TEST("pcie-root-port-q35",
>              QEMU_CAPS_DEVICE_IOH3420,
> -            QEMU_CAPS_ICH9_AHCI,
> -            QEMU_CAPS_PCI_MULTIFUNCTION,
> -            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
> -            QEMU_CAPS_DEVICE_QXL);
> +            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
> +            QEMU_CAPS_PCI_MULTIFUNCTION);
> +
>      DO_TEST("autoindex",
>              QEMU_CAPS_DEVICE_PCI_BRIDGE,
>              QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> @@ -2294,6 +2297,20 @@ mymain(void)
>      DO_TEST_FAILURE("aarch64-kvm-32-on-64",
>              QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
>              QEMU_CAPS_KVM);
> +
> +    /* Make sure the default model for PCIe Root Ports is picked correctly
> +     * according to architecture, machine type and binary capabilities; also
> +     * make sure that the user can override the default */
> +    DO_TEST("pcie-root-port-mach-virt-generic",
> +            QEMU_CAPS_OBJECT_GPEX,
> +            QEMU_CAPS_DEVICE_IOH3420,
> +            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
> +            QEMU_CAPS_PCI_MULTIFUNCTION);
> +    DO_TEST("pcie-root-port-mach-virt-ioh3420",
> +            QEMU_CAPS_OBJECT_GPEX,
> +            QEMU_CAPS_DEVICE_IOH3420,
> +            QEMU_CAPS_PCI_MULTIFUNCTION);
> +
>      qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
>  
>      DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml
> new file mode 100644
> index 0000000..0eabafd
> --- /dev/null
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-generic.xml
> @@ -0,0 +1,38 @@
> +<domain type='qemu'>
> +  <name>mach-virt-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static'>2</vcpu>
> +  <os>
> +    <type arch='aarch64' machine='virt'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <features>
> +    <gic version='2'/>
> +  </features>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='pcie-root-port'>
> +      <model name='pcie-root-port'/>
> +      <target chassis='1' port='0x8'/>
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pcie-root-port'>
> +      <model name='ioh3420'/>
> +      <target chassis='2' port='0x9'/>
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
> +    </controller>
> +    <controller type='pci' index='3' model='pcie-root-port'>
> +      <model name='pcie-root-port'/>
> +      <target chassis='3' port='0xa'/>
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
> +    </controller>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml
> new file mode 100644
> index 0000000..6c80d2a
> --- /dev/null
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-mach-virt-ioh3420.xml
> @@ -0,0 +1,33 @@
> +<domain type='qemu'>
> +  <name>mach-virt-test</name>
> +  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <currentMemory unit='KiB'>2097152</currentMemory>
> +  <vcpu placement='static'>2</vcpu>
> +  <os>
> +    <type arch='aarch64' machine='virt'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <features>
> +    <gic version='2'/>
> +  </features>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/libexec/qemu-kvm</emulator>
> +    <controller type='pci' index='0' model='pcie-root'/>
> +    <controller type='pci' index='1' model='pcie-root-port'>
> +      <model name='ioh3420'/>
> +      <target chassis='1' port='0x8'/>
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
> +    </controller>
> +    <controller type='pci' index='2' model='pcie-root-port'>
> +      <model name='ioh3420'/>
> +      <target chassis='2' port='0x9'/>
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
> +    </controller>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-q35.xml
> similarity index 71%
> rename from tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
> rename to tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-q35.xml
> index 5775eb9..0e6bb98 100644
> --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port-q35.xml
> @@ -3,7 +3,7 @@
>    <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
>    <memory unit='KiB'>2097152</memory>
>    <currentMemory unit='KiB'>2097152</currentMemory>
> -  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> +  <vcpu placement='static'>2</vcpu>

You made some other changes to the input XML beyond just the differences
in root ports. Mostly they're innocuous and easy to verify, but...

>    <os>
>      <type arch='x86_64' machine='q35'>hvm</type>
>      <boot dev='hd'/>
> @@ -14,11 +14,6 @@
>    <on_crash>destroy</on_crash>
>    <devices>
>      <emulator>/usr/libexec/qemu-kvm</emulator>
> -    <disk type='block' device='disk'>
> -      <source dev='/dev/HostVG/QEMUGuest1'/>
> -      <target dev='sda' bus='sata'/>
> -      <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='pcie-root-port'>
>        <model name='ioh3420'/>
> @@ -27,18 +22,20 @@
>      </controller>
>      <controller type='pci' index='2' model='pcie-root-port'>
>        <model name='ioh3420'/>
> -      <target chassis='40' port='0x1a'/>
> +      <target chassis='2' port='0x11'/>

...you removed the <target chassis='40' port='0x1a'/> from the input
file, but that was there for a reason - it was in the test to assure
that non-default values specified for chassis and port would be honored.
Please put that back in.

>        <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
>      </controller>
> +    <controller type='pci' index='3' model='pcie-root-port'>
> +      <model name='pcie-root-port'/>
> +      <target chassis='3' port='0x12'/>
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
> +    </controller>
> +    <controller type='usb' index='0' model='none'/>
>      <controller type='sata' index='0'>
>        <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
>      </controller>
>      <input type='mouse' bus='ps2'/>
>      <input type='keyboard' bus='ps2'/>
> -    <video>
> -      <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/>
> -      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
> -    </video>
>      <memballoon model='none'/>
>    </devices>
>  </domain>
> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
> index 4353ad2..950d1c5 100644
> --- a/tests/qemuxml2xmltest.c
> +++ b/tests/qemuxml2xmltest.c
> @@ -884,12 +884,24 @@ mymain(void)
>              QEMU_CAPS_ICH9_AHCI,
>              QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
>              QEMU_CAPS_DEVICE_QXL);
> -    DO_TEST("pcie-root-port",
> +
> +    /* Make sure the default model for PCIe Root Ports is picked correctly
> +     * according to architecture, machine type and binary capabilities; also
> +     * make sure that the user can override the default */

+1 for putting comments here to give future me (and you) a clue about
what these tests are testing for, so that maybe they won't be
unintentionally invalidated.


> +    DO_TEST("pcie-root-port-q35",
>              QEMU_CAPS_DEVICE_IOH3420,

If we were going to continue using ioh3420 for Q35, I would suggest that
you should add QEMU_CAPS_DEVICE_PCIE_ROOT_PORT here to verify that the
output still uses ioh3420. But as I said earlier I think we should
switch Q35 to using the generic root port too, so.... you *still* should
add that CAP, and change the expected output (and add a separate
"...-q35-old" test that doesn't have the cap for the generic root port)

> -            QEMU_CAPS_ICH9_AHCI,
> -            QEMU_CAPS_PCI_MULTIFUNCTION,
> -            QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
> -            QEMU_CAPS_DEVICE_QXL);
> +            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
> +            QEMU_CAPS_PCI_MULTIFUNCTION);
> +    DO_TEST("pcie-root-port-mach-virt-generic",
> +            QEMU_CAPS_OBJECT_GPEX,
> +            QEMU_CAPS_DEVICE_IOH3420,
> +            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
> +            QEMU_CAPS_PCI_MULTIFUNCTION);
> +    DO_TEST("pcie-root-port-mach-virt-ioh3420",
> +            QEMU_CAPS_OBJECT_GPEX,
> +            QEMU_CAPS_DEVICE_IOH3420,
> +            QEMU_CAPS_PCI_MULTIFUNCTION);
> +
>      DO_TEST("pcie-switch-upstream-port",
>              QEMU_CAPS_DEVICE_IOH3420,
>              QEMU_CAPS_DEVICE_X3130_UPSTREAM,
> 


ACK with the <target ...> you removed from the -q35 test added back in.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/4] tests: Test generic PCIe Root Ports
Posted by Andrea Bolognani 8 years, 11 months ago
On Wed, 2017-03-15 at 17:49 -0400, Laine Stump wrote:
[...]
> > @@ -3,7 +3,7 @@
> >    <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
> >    <memory unit='KiB'>2097152</memory>
> >    <currentMemory unit='KiB'>2097152</currentMemory>
> > -  <vcpu placement='static' cpuset='0-1'>2</vcpu>
> > +  <vcpu placement='static'>2</vcpu>
> 
> You made some other changes to the input XML beyond just the differences
> in root ports. Mostly they're innocuous and easy to verify, but...

[...]
> >      </controller>
> >      <controller type='pci' index='2' model='pcie-root-port'>
> >        <model name='ioh3420'/>
> > -      <target chassis='40' port='0x1a'/>
> > +      <target chassis='2' port='0x11'/>
> 
> ...you removed the <target chassis='40' port='0x1a'/> from the input
> file, but that was there for a reason - it was in the test to assure
> that non-default values specified for chassis and port would be honored.
> Please put that back in.

I'll just leave it alone and add a comment about its purpose
instead. Possibly change the name so it reflects the idea
behind the test a little bit better.

> > +    DO_TEST("pcie-root-port-q35",
> >              QEMU_CAPS_DEVICE_IOH3420,
> 
> If we were going to continue using ioh3420 for Q35, I would suggest that
> you should add QEMU_CAPS_DEVICE_PCIE_ROOT_PORT here to verify that the
> output still uses ioh3420.

It's there, exactly for that purpose ;)

> But as I said earlier I think we should
> switch Q35 to using the generic root port too, so.... you *still* should
> add that CAP, and change the expected output (and add a separate
> "...-q35-old" test that doesn't have the cap for the generic root port)

Yeah, I'll have just two new tests, one where the capability
for the new controller is present and one where it's not.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/4] tests: Test generic PCIe Root Ports
Posted by Laine Stump 8 years, 11 months ago
On 03/16/2017 10:37 AM, Andrea Bolognani wrote:
> On Wed, 2017-03-15 at 17:49 -0400, Laine Stump wrote:
> [...]
>>> @@ -3,7 +3,7 @@
>>>     <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
>>>     <memory unit='KiB'>2097152</memory>
>>>     <currentMemory unit='KiB'>2097152</currentMemory>
>>> -  <vcpu placement='static' cpuset='0-1'>2</vcpu>
>>> +  <vcpu placement='static'>2</vcpu>
>>  
>> You made some other changes to the input XML beyond just the differences
>> in root ports. Mostly they're innocuous and easy to verify, but...
> 
> [...]
>>>       </controller>
>>>       <controller type='pci' index='2' model='pcie-root-port'>
>>>         <model name='ioh3420'/>
>>> -      <target chassis='40' port='0x1a'/>
>>> +      <target chassis='2' port='0x11'/>
>>  
>> ...you removed the <target chassis='40' port='0x1a'/> from the input
>> file, but that was there for a reason - it was in the test to assure
>> that non-default values specified for chassis and port would be honored.
>> Please put that back in.
> 
> I'll just leave it alone and add a comment about its purpose
> instead. Possibly change the name so it reflects the idea
> behind the test a little bit better.

It was the original test added when we added support for pcie-root-port,
and the idea behind the test was to test automatic and manual setting of
every associated attribute (i.e. it's not a special purpose test
intended just to test manual setting of the attributes in <target>, if
that's what you're implying.


> 
>>> +    DO_TEST("pcie-root-port-q35",
>>>               QEMU_CAPS_DEVICE_IOH3420,
>>  
>> If we were going to continue using ioh3420 for Q35, I would suggest that
>> you should add QEMU_CAPS_DEVICE_PCIE_ROOT_PORT here to verify that the
>> output still uses ioh3420.
> 
> It's there, exactly for that purpose ;)

Yeah, I don't know how I missed that.

> 
>> But as I said earlier I think we should
>> switch Q35 to using the generic root port too, so.... you *still* should
>> add that CAP, and change the expected output (and add a separate
>> "...-q35-old" test that doesn't have the cap for the generic root port)
> 
> Yeah, I'll have just two new tests, one where the capability
> for the new controller is present and one where it's not.
> 
> -- 
> Andrea Bolognani / Red Hat / Virtualization
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list