[PATCH v2 2/2] cpu_ppc64: add support for host-model on POWER10

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/cpu/cpu_ppc64.c                           |  8 ++---
 .../pseries-cpu-compat-power10.args           | 32 +++++++++++++++++++
 .../pseries-cpu-compat-power10.err            |  1 +
 .../pseries-cpu-compat-power10.xml            | 21 ++++++++++++
 tests/qemuxml2argvtest.c                      | 11 +++++++
 tests/testutilshostcpus.h                     | 11 +++++++
 tests/testutilsqemu.c                         |  4 ++-
 tests/testutilsqemu.h                         |  1 +
 8 files changed, 84 insertions(+), 5 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/pseries-cpu-compat-power10.args
 create mode 100644 tests/qemuxml2argvdata/pseries-cpu-compat-power10.err
 create mode 100644 tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 314d2f7c86..087635404d 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -88,22 +88,22 @@ ppc64CheckCompatibilityMode(const char *host_model,
     if (!compat_mode)
         return VIR_CPU_COMPARE_IDENTICAL;
 
-    /* Valid host CPUs: POWER6, POWER7, POWER8, POWER9 */
+    /* Valid host CPUs: POWER6, POWER7, POWER8, POWER9, POWER10 */
     if (!STRPREFIX(host_model, "POWER") ||
         !(tmp = (char *) host_model + strlen("POWER")) ||
         virStrToLong_i(tmp, NULL, 10, &host) < 0 ||
-        host < 6 || host > 9) {
+        host < 6 || host > 10) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s",
                        _("Host CPU does not support compatibility modes"));
         return VIR_CPU_COMPARE_ERROR;
     }
 
-    /* Valid compatibility modes: power6, power7, power8, power9 */
+    /* Valid compatibility modes: power6, power7, power8, power9, power10 */
     if (!STRPREFIX(compat_mode, "power") ||
         !(tmp = (char *) compat_mode + strlen("power")) ||
         virStrToLong_i(tmp, NULL, 10, &compat) < 0 ||
-        compat < 6 || compat > 9) {
+        compat < 6 || compat > 10) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unknown compatibility mode %s"),
                        compat_mode);
diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat-power10.args b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.args
new file mode 100644
index 0000000000..cc485d960f
--- /dev/null
+++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.args
@@ -0,0 +1,32 @@
+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 pseries,usb=off,dump-guest-core=off,max-cpu-compat=power10 \
+-accel kvm \
+-cpu host \
+-m 256 \
+-overcommit mem-lock=off \
+-smp 4,sockets=4,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-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 \
+-boot strict=on \
+-usb \
+-chardev pty,id=charserial0 \
+-device spapr-vty,chardev=charserial0,id=serial0,reg=805306368 \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat-power10.err b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.err
new file mode 100644
index 0000000000..f2322ccea5
--- /dev/null
+++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.err
@@ -0,0 +1 @@
+the CPU is incompatible with host CPU
diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml
new file mode 100644
index 0000000000..1414f5bb75
--- /dev/null
+++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml
@@ -0,0 +1,21 @@
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+  </os>
+  <cpu mode='host-model'>
+    <model>power10</model>
+  </cpu>
+  <clock offset='utc'/>
+  <devices>
+      <emulator>/usr/bin/qemu-system-ppc64</emulator>
+      <console type='pty'>
+        <address type="spapr-vio"/>
+      </console>
+      <memballoon model="none"/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1f080daba7..78e7d89f8e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2209,6 +2209,17 @@ mymain(void)
             QEMU_CAPS_DEVICE_SPAPR_VTY);
     qemuTestSetHostCPU(&driver, driver.hostarch, NULL);
 
+    DO_TEST_FAILURE("pseries-cpu-compat-power10",
+                    QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+                    QEMU_CAPS_KVM);
+
+    qemuTestSetHostCPU(&driver, driver.hostarch, cpuPower10);
+    DO_TEST("pseries-cpu-compat-power10",
+            QEMU_CAPS_KVM,
+            QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+            QEMU_CAPS_DEVICE_SPAPR_VTY);
+    qemuTestSetHostCPU(&driver, driver.hostarch, NULL);
+
     qemuTestSetHostArch(&driver, VIR_ARCH_NONE);
 
     DO_TEST("pseries-panic-missing",
diff --git a/tests/testutilshostcpus.h b/tests/testutilshostcpus.h
index cf0fc833e1..e38d7c8b5a 100644
--- a/tests/testutilshostcpus.h
+++ b/tests/testutilshostcpus.h
@@ -114,6 +114,15 @@ static virCPUDef cpuPower9Data = {
     .threads = 1,
 };
 
+static virCPUDef cpuPower10Data = {
+    .type = VIR_CPU_TYPE_HOST,
+    .arch = VIR_ARCH_PPC64,
+    .model = (char *) "POWER10",
+    .sockets = 1,
+    .cores = 16,
+    .threads = 1,
+};
+
 static virCPUDef cpuAarch64Data = {
     .type = VIR_CPU_TYPE_HOST,
     .arch = VIR_ARCH_AARCH64,
@@ -154,6 +163,8 @@ testUtilsHostCpusGetDefForModel(const char *model)
         return virCPUDefCopy(&cpuPower8Data);
     else if (STREQ(model, "POWER9"))
         return virCPUDefCopy(&cpuPower9Data);
+    else if (STREQ(model, "POWER10"))
+        return virCPUDefCopy(&cpuPower10Data);
 
     return NULL;
 }
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 105b41cbeb..8f1b72890a 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -22,6 +22,7 @@ virCPUDef *cpuDefault;
 virCPUDef *cpuHaswell;
 virCPUDef *cpuPower8;
 virCPUDef *cpuPower9;
+virCPUDef *cpuPower10;
 
 
 static const char *qemu_emulators[VIR_ARCH_LAST] = {
@@ -567,7 +568,8 @@ int qemuTestDriverInit(virQEMUDriver *driver)
     if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) ||
         !(cpuHaswell = virCPUDefCopy(&cpuHaswellData)) ||
         !(cpuPower8 = virCPUDefCopy(&cpuPower8Data)) ||
-        !(cpuPower9 = virCPUDefCopy(&cpuPower9Data)))
+        !(cpuPower9 = virCPUDefCopy(&cpuPower9Data)) ||
+        !(cpuPower10 = virCPUDefCopy(&cpuPower10Data)))
         return -1;
 
     if (virMutexInit(&driver->lock) < 0)
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 187f9b7cd3..76a6954019 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -106,6 +106,7 @@ extern virCPUDef *cpuDefault;
 extern virCPUDef *cpuHaswell;
 extern virCPUDef *cpuPower8;
 extern virCPUDef *cpuPower9;
+extern virCPUDef *cpuPower10;
 
 void qemuTestSetHostArch(virQEMUDriver *driver,
                          virArch arch);
-- 
2.32.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux