testutilsqemu: Add default CPU for PPC64 architectures

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-09-13 22:27:09 +02:00
parent 127e0b53ec
commit bfc5a5e6ff
2 changed files with 16 additions and 1 deletions

View File

@ -16,6 +16,7 @@
virCPUDefPtr cpuDefault; virCPUDefPtr cpuDefault;
virCPUDefPtr cpuHaswell; virCPUDefPtr cpuHaswell;
virCPUDefPtr cpuPower8;
static virCPUFeatureDef cpuDefaultFeatures[] = { static virCPUFeatureDef cpuDefaultFeatures[] = {
{ (char *) "lahf_lm", -1 }, { (char *) "lahf_lm", -1 },
@ -92,6 +93,15 @@ static virCPUDef cpuHaswellData = {
cpuHaswellFeatures, /* features */ 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) static virCapsGuestMachinePtr *testQemuAllocMachines(int *nmachines)
{ {
virCapsGuestMachinePtr *machines; virCapsGuestMachinePtr *machines;
@ -331,7 +341,8 @@ virCapsPtr testQemuCapsInit(void)
goto cleanup; goto cleanup;
if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) || if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) ||
!(cpuHaswell = virCPUDefCopy(&cpuHaswellData))) !(cpuHaswell = virCPUDefCopy(&cpuHaswellData)) ||
!(cpuPower8 = virCPUDefCopy(&cpuPower8Data)))
goto cleanup; goto cleanup;
qemuTestSetHostCPU(caps, NULL); qemuTestSetHostCPU(caps, NULL);
@ -443,6 +454,7 @@ virCapsPtr testQemuCapsInit(void)
caps->host.cpu = NULL; caps->host.cpu = NULL;
virCPUDefFree(cpuDefault); virCPUDefFree(cpuDefault);
virCPUDefFree(cpuHaswell); virCPUDefFree(cpuHaswell);
virCPUDefFree(cpuPower8);
virObjectUnref(caps); virObjectUnref(caps);
return NULL; return NULL;
} }
@ -468,6 +480,8 @@ qemuTestSetHostCPU(virCapsPtr caps,
if (!cpu) { if (!cpu) {
if (ARCH_IS_X86(arch)) if (ARCH_IS_X86(arch))
cpu = cpuDefault; cpu = cpuDefault;
else if (ARCH_IS_PPC64(arch))
cpu = cpuPower8;
} }
if (cpu) if (cpu)

View File

@ -19,6 +19,7 @@ virQEMUCapsPtr qemuTestParseCapabilities(const char *capsFile);
extern virCPUDefPtr cpuDefault; extern virCPUDefPtr cpuDefault;
extern virCPUDefPtr cpuHaswell; extern virCPUDefPtr cpuHaswell;
extern virCPUDefPtr cpuPower8;
void qemuTestSetHostArch(virCapsPtr caps, void qemuTestSetHostArch(virCapsPtr caps,
virArch arch); virArch arch);