[PATCH 2/3] 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 ++--
 ...eries-cpu-compat-power10.ppc64-latest.args | 34 +++++++++++++++
 ...series-cpu-compat-power10.ppc64-latest.err |  1 +
 .../pseries-cpu-compat-power10.xml            | 21 ++++++++++
 tests/qemuxml2argvtest.c                      |  4 ++
 ...series-cpu-compat-power10.ppc64-latest.xml | 41 +++++++++++++++++++
 tests/qemuxml2xmltest.c                       |  1 +
 tests/testutilshostcpus.h                     | 11 +++++
 tests/testutilsqemu.c                         |  6 ++-
 tests/testutilsqemu.h                         |  2 +
 10 files changed, 124 insertions(+), 5 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.args
 create mode 100644 tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.err
 create mode 100644 tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml
 create mode 100644 tests/qemuxml2xmloutdata/pseries-cpu-compat-power10.ppc64-latest.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.ppc64-latest.args b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.args
new file mode 100644
index 0000000000..aafe35c0f8
--- /dev/null
+++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.args
@@ -0,0 +1,34 @@
+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 \
+/usr/bin/qemu-system-ppc64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"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,memory-backend=ppc_spapr.ram \
+-accel kvm \
+-cpu host \
+-m 256 \
+-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":268435456}' \
+-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 \
+-device '{"driver":"pci-ohci","id":"usb","bus":"pci.0","addr":"0x1"}' \
+-chardev pty,id=charserial0 \
+-device '{"driver":"spapr-vty","chardev":"charserial0","id":"serial0","reg":805306368}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.err b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.err
new file mode 100644
index 0000000000..f2322ccea5
--- /dev/null
+++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.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 5ae245d254..bffe7aef8a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2239,6 +2239,10 @@ mymain(void)
                                               QEMU_CPU_DEF_POWER8);
     DO_TEST_CAPS_LATEST_PPC64_HOSTCPU("pseries-cpu-compat-power9",
                                       QEMU_CPU_DEF_POWER9);
+    DO_TEST_CAPS_LATEST_PPC64_HOSTCPU_FAILURE("pseries-cpu-compat-power10",
+                                              QEMU_CPU_DEF_POWER9);
+    DO_TEST_CAPS_LATEST_PPC64_HOSTCPU("pseries-cpu-compat-power10",
+                                      QEMU_CPU_DEF_POWER10);
 
     qemuTestSetHostArch(&driver, VIR_ARCH_NONE);
 
diff --git a/tests/qemuxml2xmloutdata/pseries-cpu-compat-power10.ppc64-latest.xml b/tests/qemuxml2xmloutdata/pseries-cpu-compat-power10.ppc64-latest.xml
new file mode 100644
index 0000000000..f0fb8fe836
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/pseries-cpu-compat-power10.ppc64-latest.xml
@@ -0,0 +1,41 @@
+<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>
+    <boot dev='hd'/>
+  </os>
+  <cpu mode='host-model' check='partial'>
+    <model fallback='allow'>power10</model>
+  </cpu>
+  <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='usb' index='0' model='pci-ohci'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'>
+      <model name='spapr-pci-host-bridge'/>
+      <target index='0'/>
+    </controller>
+    <serial type='pty'>
+      <target type='spapr-vio-serial' port='0'>
+        <model name='spapr-vty'/>
+      </target>
+      <address type='spapr-vio' reg='0x30000000'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+      <address type='spapr-vio' reg='0x30000000'/>
+    </console>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+    <panic model='pseries'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 9ac43d3294..3bd57306cc 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1286,6 +1286,7 @@ mymain(void)
     DO_TEST("smartcard-controller", QEMU_CAPS_CCID_EMULATED);
 
     DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-compat-power9", "ppc64");
+    DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-compat-power10", "ppc64");
     DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-compat", "ppc64");
     DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-exact", "ppc64");
 
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 7e4e5d28b7..6211b2a871 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -22,6 +22,7 @@ static virCPUDef *cpuDefault;
 static virCPUDef *cpuHaswell;
 static virCPUDef *cpuPower8;
 static virCPUDef *cpuPower9;
+static virCPUDef *cpuPower10;
 
 
 static const char *qemu_emulators[VIR_ARCH_LAST] = {
@@ -308,6 +309,7 @@ qemuTestGetCPUDef(qemuTestCPUDef d)
     case QEMU_CPU_DEF_HASWELL: return cpuHaswell;
     case QEMU_CPU_DEF_POWER8: return cpuPower8;
     case QEMU_CPU_DEF_POWER9: return cpuPower9;
+    case QEMU_CPU_DEF_POWER10: return cpuPower10;
     }
 
     return NULL;
@@ -391,6 +393,7 @@ void qemuTestDriverFree(virQEMUDriver *driver)
     virCPUDefFree(cpuHaswell);
     virCPUDefFree(cpuPower8);
     virCPUDefFree(cpuPower9);
+    virCPUDefFree(cpuPower10);
 }
 
 
@@ -581,7 +584,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 5419b813ea..9755d02eff 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -72,6 +72,7 @@ typedef enum {
     QEMU_CPU_DEF_HASWELL,
     QEMU_CPU_DEF_POWER8,
     QEMU_CPU_DEF_POWER9,
+    QEMU_CPU_DEF_POWER10,
 } qemuTestCPUDef;
 
 struct testQemuArgs {
@@ -110,6 +111,7 @@ virDomainXMLOption *testQemuXMLConfInit(void);
 
 virQEMUCaps *qemuTestParseCapabilitiesArch(virArch arch,
                                              const char *capsFile);
+
 virCPUDef *qemuTestGetCPUDef(qemuTestCPUDef d);
 
 void qemuTestSetHostArch(virQEMUDriver *driver,
-- 
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