From 0a97486e092c421ada4a9fb51e5b0cbcf0b1c071 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Sun, 14 Apr 2019 21:44:01 +0200 Subject: [PATCH] cpu_x86: Fix placement of *CheckFeature functions In e17d10386 these functions were mistakenly moved into an #ifdef block, but remained used outside of it leaving the build broken for platforms where #ifdef evaluated to false. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/cpu/cpu_x86.c | 56 ++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 1fe6770d57..f05bfa24e0 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2707,6 +2707,35 @@ cpuidSet(uint32_t base, virCPUDataPtr data) } + + +static int +virCPUx86GetHost(virCPUDefPtr cpu, + virDomainCapsCPUModelsPtr models) +{ + virCPUDataPtr cpuData = NULL; + int ret = -1; + + if (virCPUx86DriverInitialize() < 0) + goto cleanup; + + if (!(cpuData = virCPUDataNew(archs[0]))) + goto cleanup; + + if (cpuidSet(CPUX86_BASIC, cpuData) < 0 || + cpuidSet(CPUX86_EXTENDED, cpuData) < 0) + goto cleanup; + + ret = x86DecodeCPUData(cpu, cpuData, models); + cpu->microcodeVersion = virHostCPUGetMicrocodeVersion(); + + cleanup: + virCPUx86DataFree(cpuData); + return ret; +} +#endif + + static int virCPUx86CheckFeature(const virCPUDef *cpu, const char *name) @@ -2742,33 +2771,6 @@ virCPUx86DataCheckFeature(const virCPUData *data, } -static int -virCPUx86GetHost(virCPUDefPtr cpu, - virDomainCapsCPUModelsPtr models) -{ - virCPUDataPtr cpuData = NULL; - int ret = -1; - - if (virCPUx86DriverInitialize() < 0) - goto cleanup; - - if (!(cpuData = virCPUDataNew(archs[0]))) - goto cleanup; - - if (cpuidSet(CPUX86_BASIC, cpuData) < 0 || - cpuidSet(CPUX86_EXTENDED, cpuData) < 0) - goto cleanup; - - ret = x86DecodeCPUData(cpu, cpuData, models); - cpu->microcodeVersion = virHostCPUGetMicrocodeVersion(); - - cleanup: - virCPUx86DataFree(cpuData); - return ret; -} -#endif - - static virCPUDefPtr virCPUx86Baseline(virCPUDefPtr *cpus, unsigned int ncpus,