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..6986d835eb --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.ppc64-latest.args @@ -0,0 +1,31 @@ +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 \ +-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..57b83c7aa5 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 4 + + hvm + + + power10 + + + + /usr/bin/qemu-system-ppc64 + + + + 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..557f81ac4e --- /dev/null +++ b/tests/qemuxml2xmloutdata/pseries-cpu-compat-power10.ppc64-latest.xml @@ -0,0 +1,29 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 4 + + hvm + + + + power10 + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + 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..7ce4c4ad8d 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 {