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 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)

View File

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