From bfc5a5e6ff14eacb1f2f3e1b8dc93fac31c4f355 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Tue, 13 Sep 2016 22:27:09 +0200 Subject: [PATCH] testutilsqemu: Add default CPU for PPC64 architectures Signed-off-by: Jiri Denemark --- tests/testutilsqemu.c | 16 +++++++++++++++- tests/testutilsqemu.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index b569e0d5fd..f59746a4d9 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -16,6 +16,7 @@ virCPUDefPtr cpuDefault; virCPUDefPtr cpuHaswell; +virCPUDefPtr cpuPower8; static virCPUFeatureDef cpuDefaultFeatures[] = { { (char *) "lahf_lm", -1 }, @@ -92,6 +93,15 @@ static virCPUDef cpuHaswellData = { cpuHaswellFeatures, /* features */ }; +static virCPUDef cpuPower8Data = { + .type = VIR_CPU_TYPE_HOST, + .arch = VIR_ARCH_PPC64, + .model = (char *) "POWER8", + .sockets = 1, + .cores = 8, + .threads = 8, +}; + static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines) { virCapsGuestMachinePtr *machines; @@ -331,7 +341,8 @@ virCapsPtr testQemuCapsInit(void) goto cleanup; if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) || - !(cpuHaswell = virCPUDefCopy(&cpuHaswellData))) + !(cpuHaswell = virCPUDefCopy(&cpuHaswellData)) || + !(cpuPower8 = virCPUDefCopy(&cpuPower8Data))) goto cleanup; qemuTestSetHostCPU(caps, NULL); @@ -443,6 +454,7 @@ virCapsPtr testQemuCapsInit(void) caps->host.cpu = NULL; virCPUDefFree(cpuDefault); virCPUDefFree(cpuHaswell); + virCPUDefFree(cpuPower8); virObjectUnref(caps); return NULL; } @@ -468,6 +480,8 @@ qemuTestSetHostCPU(virCapsPtr caps, if (!cpu) { if (ARCH_IS_X86(arch)) cpu = cpuDefault; + else if (ARCH_IS_PPC64(arch)) + cpu = cpuPower8; } if (cpu) diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index 7c678c9f01..6d35116f36 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -19,6 +19,7 @@ virQEMUCapsPtr qemuTestParseCapabilities(const char *capsFile); extern virCPUDefPtr cpuDefault; extern virCPUDefPtr cpuHaswell; +extern virCPUDefPtr cpuPower8; void qemuTestSetHostArch(virCapsPtr caps, virArch arch);