[PATCH 33/33] tests: add PowerNV9 tests

Daniel Henrique Barboza danielhb413 at gmail.com
Thu Jan 20 13:52:36 UTC 2022


Since the nuances of PowerNV PHBs and root ports were already handled
when adding support for pnv-phb3* devices, we're already set to support
PowerNV9 PHBs and root ports as well.

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 tests/qemuxml2argvdata/powernv9-dupPHBs.err   |  1 +
 tests/qemuxml2argvdata/powernv9-dupPHBs.xml   | 27 ++++++++++++++
 .../qemuxml2argvdata/powernv9-root-port.args  | 33 +++++++++++++++++
 tests/qemuxml2argvdata/powernv9-root-port.xml | 17 +++++++++
 tests/qemuxml2argvtest.c                      |  7 ++++
 .../qemuxml2xmloutdata/powernv9-root-port.xml | 36 +++++++++++++++++++
 tests/qemuxml2xmltest.c                       |  4 +++
 tests/testutilsqemu.c                         |  2 +-
 8 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/powernv9-dupPHBs.err
 create mode 100644 tests/qemuxml2argvdata/powernv9-dupPHBs.xml
 create mode 100644 tests/qemuxml2argvdata/powernv9-root-port.args
 create mode 100644 tests/qemuxml2argvdata/powernv9-root-port.xml
 create mode 100644 tests/qemuxml2xmloutdata/powernv9-root-port.xml

diff --git a/tests/qemuxml2argvdata/powernv9-dupPHBs.err b/tests/qemuxml2argvdata/powernv9-dupPHBs.err
new file mode 100644
index 0000000000..bc5879640d
--- /dev/null
+++ b/tests/qemuxml2argvdata/powernv9-dupPHBs.err
@@ -0,0 +1 @@
+XML error: Multiple pnv-phb controllers with same chip-id and index
diff --git a/tests/qemuxml2argvdata/powernv9-dupPHBs.xml b/tests/qemuxml2argvdata/powernv9-dupPHBs.xml
new file mode 100644
index 0000000000..49af69e6c4
--- /dev/null
+++ b/tests/qemuxml2argvdata/powernv9-dupPHBs.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>b20fcfe3-4a0a-4039-8735-9e024256e0f7</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='powernv9'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <controller type='pci' index='0' model='pcie-root'>
+      <model name='pnv-phb4'/>
+      <target index='0' chip-id='0'/>
+    </controller>
+    <controller type='pci' index='1' model='pcie-root'>
+      <model name='pnv-phb4'/>
+      <target index='1' chip-id='0'/>
+    </controller>
+    <controller type='pci' index='2' model='pcie-root'>
+      <model name='pnv-phb4'/>
+      <target index='1' chip-id='0'/>
+    </controller>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/powernv9-root-port.args b/tests/qemuxml2argvdata/powernv9-root-port.args
new file mode 100644
index 0000000000..a754f2bc17
--- /dev/null
+++ b/tests/qemuxml2argvdata/powernv9-root-port.args
@@ -0,0 +1,33 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-ppc64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine powernv9,usb=off,dump-guest-core=off \
+-accel tcg \
+-m 2048 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid b20fcfe3-4a0a-4039-8735-9e024256e0f7 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device pnv-phb4,index=0,chip-id=0,id=pcie.0 \
+-device pnv-phb4-root-port,port=0,chassis=1,id=pci.1,bus=pcie.0,addr=0x0 \
+-usb \
+-chardev pty,id=charserial0 \
+-device isa-serial,chardev=charserial0,id=serial0,index=0 \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/powernv9-root-port.xml b/tests/qemuxml2argvdata/powernv9-root-port.xml
new file mode 100644
index 0000000000..dfd74446f9
--- /dev/null
+++ b/tests/qemuxml2argvdata/powernv9-root-port.xml
@@ -0,0 +1,17 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>b20fcfe3-4a0a-4039-8735-9e024256e0f7</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='powernv9'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='pci' index='1' model='pcie-root-port'/>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ff8698927e..ed3abcc13b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2227,6 +2227,13 @@ mymain(void)
     DO_TEST_PARSE_ERROR("powernv8-dupPHBs",
                         QEMU_CAPS_DEVICE_ISA_SERIAL,
                         QEMU_CAPS_DEVICE_PNV_PHB3);
+    DO_TEST("powernv9-root-port",
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
+            QEMU_CAPS_DEVICE_PNV_PHB4,
+            QEMU_CAPS_DEVICE_PNV_PHB4_ROOT_PORT);
+    DO_TEST_PARSE_ERROR("powernv9-dupPHBs",
+                        QEMU_CAPS_DEVICE_ISA_SERIAL,
+                        QEMU_CAPS_DEVICE_PNV_PHB4);
 
     DO_TEST("pseries-basic",
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
diff --git a/tests/qemuxml2xmloutdata/powernv9-root-port.xml b/tests/qemuxml2xmloutdata/powernv9-root-port.xml
new file mode 100644
index 0000000000..5649526969
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/powernv9-root-port.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>b20fcfe3-4a0a-4039-8735-9e024256e0f7</uuid>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='powernv9'>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/bin/qemu-system-ppc64</emulator>
+    <controller type='pci' index='0' model='pcie-root'>
+      <model name='pnv-phb4'/>
+      <target index='0' chip-id='0'/>
+    </controller>
+    <controller type='pci' index='1' model='pcie-root-port'>
+      <model name='pnv-phb4-root-port'/>
+      <target chassis='1' port='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
+    </controller>
+    <serial type='pty'>
+      <target type='isa-serial' port='0'>
+        <model name='isa-serial'/>
+      </target>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <audio id='1' type='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 5ed8283546..c385dd4d5b 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -647,6 +647,10 @@ mymain(void)
     DO_TEST("powernv8-two-sockets",
             QEMU_CAPS_DEVICE_ISA_SERIAL,
             QEMU_CAPS_DEVICE_PNV_PHB3);
+    DO_TEST("powernv9-root-port",
+            QEMU_CAPS_DEVICE_ISA_SERIAL,
+            QEMU_CAPS_DEVICE_PNV_PHB4,
+            QEMU_CAPS_DEVICE_PNV_PHB4_ROOT_PORT);
 
     DO_TEST("pseries-nvram",
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 5d29125ffa..96d1d0db56 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -54,7 +54,7 @@ static const char *const arm_machines[] = {
     "vexpress-a9", "virt", NULL
 };
 static const char *const ppc64_machines[] = {
-    "pseries", "powernv8", NULL
+    "pseries", "powernv8", "powernv9", NULL
 };
 static const char *const ppc_machines[] = {
     "ppce500", NULL
-- 
2.34.1




More information about the libvir-list mailing list