This changes will add POWER11 host-model support to libvirt. Signed-off-by: Narayana Murty N <nnmlinux@xxxxxxxxxxxxxxxxxx> --- src/cpu/cpu_ppc64.c | 8 ++++---- tests/qemuxmlconftest.c | 4 ++++ tests/testutilshostcpus.h | 11 +++++++++++ tests/testutilsqemu.c | 4 ++++ tests/testutilsqemu.h | 1 + 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 13f5fc9c2c..8673d4f759 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -93,22 +93,22 @@ ppc64CheckCompatibilityMode(const char *host_model, if (!compat_mode) return VIR_CPU_COMPARE_IDENTICAL; - /* Valid host CPUs: POWER6, POWER7, POWER8, POWER9, POWER10 */ + /* Valid host CPUs: POWER6, POWER7, POWER8, POWER9, POWER10, POWER11 */ if (!STRPREFIX(host_model, "POWER") || !(tmp = (char *) host_model + strlen("POWER")) || virStrToLong_i(tmp, NULL, 10, &host) < 0 || - host < 6 || host > 10) { + host < 6 || host > 11) { 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, power10 */ + /* Valid compatibility modes: power6, power7, power8, power9, power10, power11 */ if (!STRPREFIX(compat_mode, "power") || !(tmp = (char *) compat_mode + strlen("power")) || virStrToLong_i(tmp, NULL, 10, &compat) < 0 || - compat < 6 || compat > 10) { + compat < 6 || compat > 11) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown compatibility mode %1$s"), compat_mode); diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index f3c8d0ae34..5038a7b7d6 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -2390,6 +2390,10 @@ mymain(void) QEMU_CPU_DEF_POWER9); DO_TEST_CAPS_LATEST_PPC64_HOSTCPU("pseries-cpu-compat-power10", QEMU_CPU_DEF_POWER10); + DO_TEST_CAPS_LATEST_PPC64_HOSTCPU_FAILURE("pseries-cpu-compat-power11", + QEMU_CPU_DEF_POWER10); + DO_TEST_CAPS_LATEST_PPC64_HOSTCPU("pseries-cpu-compat-power11", + QEMU_CPU_DEF_POWER11); qemuTestSetHostArch(&driver, VIR_ARCH_NONE); diff --git a/tests/testutilshostcpus.h b/tests/testutilshostcpus.h index 79c37baed4..36118d6acb 100644 --- a/tests/testutilshostcpus.h +++ b/tests/testutilshostcpus.h @@ -123,6 +123,15 @@ static virCPUDef cpuPower10Data = { .threads = 1, }; +static virCPUDef cpuPower11Data = { + .type = VIR_CPU_TYPE_HOST, + .arch = VIR_ARCH_PPC64, + .model = (char *) "POWER11", + .sockets = 1, + .cores = 16, + .threads = 1, +}; + static virCPUDef cpuAarch64Data = { .type = VIR_CPU_TYPE_HOST, .arch = VIR_ARCH_AARCH64, @@ -197,6 +206,8 @@ testUtilsHostCpusGetDefForModel(const char *model) return virCPUDefCopy(&cpuPower9Data); else if (STREQ(model, "POWER10")) return virCPUDefCopy(&cpuPower10Data); + else if (STREQ(model, "POWER11")) + return virCPUDefCopy(&cpuPower11Data); return NULL; } diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 5caccbc6b4..11bd2776bf 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -24,6 +24,7 @@ static virCPUDef *cpuHaswell; static virCPUDef *cpuPower8; static virCPUDef *cpuPower9; static virCPUDef *cpuPower10; +static virCPUDef *cpuPower11; char * virFindFileInPath(const char *file) @@ -161,6 +162,7 @@ qemuTestGetCPUDef(qemuTestCPUDef d) case QEMU_CPU_DEF_POWER8: return cpuPower8; case QEMU_CPU_DEF_POWER9: return cpuPower9; case QEMU_CPU_DEF_POWER10: return cpuPower10; + case QEMU_CPU_DEF_POWER11: return cpuPower11; } return NULL; @@ -246,6 +248,7 @@ void qemuTestDriverFree(virQEMUDriver *driver) virCPUDefFree(cpuPower8); virCPUDefFree(cpuPower9); virCPUDefFree(cpuPower10); + virCPUDefFree(cpuPower11); } @@ -298,6 +301,7 @@ int qemuTestDriverInit(virQEMUDriver *driver) cpuPower8 = virCPUDefCopy(&cpuPower8Data); cpuPower9 = virCPUDefCopy(&cpuPower9Data); cpuPower10 = virCPUDefCopy(&cpuPower10Data); + cpuPower11 = virCPUDefCopy(&cpuPower11Data); if (virMutexInit(&driver->lock) < 0) return -1; diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index 74e307d653..7e38884e43 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -78,6 +78,7 @@ typedef enum { QEMU_CPU_DEF_POWER8, QEMU_CPU_DEF_POWER9, QEMU_CPU_DEF_POWER10, + QEMU_CPU_DEF_POWER11, } qemuTestCPUDef; struct testQemuArgs { -- 2.47.1