Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- Notes: Version 2: - new patch (separated from 38/41) src/cpu/cpu.c | 10 +++++----- src/cpu/cpu.h | 10 +++++----- src/cpu/cpu_arm.c | 1 - src/cpu/cpu_ppc64.c | 1 - src/cpu/cpu_s390.c | 1 - src/cpu/cpu_x86.c | 6 +++--- src/libvirt_private.syms | 2 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_parse_command.c | 2 +- src/qemu/qemu_process.c | 10 +++++----- src/vmware/vmware_conf.c | 6 +++--- tests/cputest.c | 2 +- 12 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 748b6f9..99c1a4c 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -648,7 +648,7 @@ virCPUUpdate(virArch arch, /** - * cpuHasFeature: + * virCPUDataCheckFeature: * * @data: internal CPU representation * @feature: feature to be checked for @@ -659,8 +659,8 @@ virCPUUpdate(virArch arch, * -1 on error. */ int -cpuHasFeature(const virCPUData *data, - const char *feature) +virCPUDataCheckFeature(const virCPUData *data, + const char *feature) { struct cpuArchDriver *driver; @@ -669,14 +669,14 @@ cpuHasFeature(const virCPUData *data, if ((driver = cpuGetSubDriver(data->arch)) == NULL) return -1; - if (driver->hasFeature == NULL) { + if (!driver->dataCheckFeature) { virReportError(VIR_ERR_NO_SUPPORT, _("cannot check guest CPU data for %s architecture"), virArchToString(data->arch)); return -1; } - return driver->hasFeature(data, feature); + return driver->dataCheckFeature(data, feature); } diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 6a21bfa..71fa2da 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -91,8 +91,8 @@ typedef int const virCPUDef *host); typedef int -(*cpuArchHasFeature) (const virCPUData *data, - const char *feature); +(*virCPUArchDataCheckFeature)(const virCPUData *data, + const char *feature); typedef char * (*cpuArchDataFormat)(const virCPUData *data); @@ -120,7 +120,7 @@ struct cpuArchDriver { cpuArchGuestData guestData; cpuArchBaseline baseline; virCPUArchUpdate update; - cpuArchHasFeature hasFeature; + virCPUArchDataCheckFeature dataCheckFeature; cpuArchDataFormat dataFormat; cpuArchDataParse dataParse; cpuArchGetModels getModels; @@ -194,8 +194,8 @@ virCPUUpdate(virArch arch, ATTRIBUTE_NONNULL(2); int -cpuHasFeature(const virCPUData *data, - const char *feature) +virCPUDataCheckFeature(const virCPUData *data, + const char *feature) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index e8ab954..37bb71a 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -131,5 +131,4 @@ struct cpuArchDriver cpuDriverArm = { .guestData = armGuestData, .baseline = armBaseline, .update = virCPUarmUpdate, - .hasFeature = NULL, }; diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 00faa22..6f005e5 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -910,6 +910,5 @@ struct cpuArchDriver cpuDriverPPC64 = { .guestData = ppc64DriverGuestData, .baseline = ppc64DriverBaseline, .update = virCPUppc64Update, - .hasFeature = NULL, .getModels = ppc64DriverGetModels, }; diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c index 23a7f9d..fb352a0 100644 --- a/src/cpu/cpu_s390.c +++ b/src/cpu/cpu_s390.c @@ -83,5 +83,4 @@ struct cpuArchDriver cpuDriverS390 = { .guestData = NULL, .baseline = NULL, .update = NULL, - .hasFeature = NULL, }; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a45427a..ae552ac 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2602,8 +2602,8 @@ virCPUx86Update(virCPUDefPtr guest, static int -x86HasFeature(const virCPUData *data, - const char *name) +virCPUx86DataCheckFeature(const virCPUData *data, + const char *name) { virCPUx86MapPtr map; @@ -2709,7 +2709,7 @@ struct cpuArchDriver cpuDriverX86 = { .guestData = x86GuestData, .baseline = x86Baseline, .update = virCPUx86Update, - .hasFeature = x86HasFeature, + .dataCheckFeature = virCPUx86DataCheckFeature, .dataFormat = x86CPUDataFormat, .dataParse = x86CPUDataParse, .getModels = x86GetModels, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index aa8d390..8575f55 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -973,8 +973,8 @@ cpuDecode; cpuEncode; cpuGetModels; cpuGuestData; -cpuHasFeature; cpuNodeData; +virCPUDataCheckFeature; virCPUTranslate; virCPUUpdate; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b96f101..1154ac6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6600,7 +6600,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, */ if ((def->os.arch == VIR_ARCH_X86_64 || def->os.arch == VIR_ARCH_I686) && compareAgainstHost) { - int hasSVM = cpuHasFeature(data, "svm"); + int hasSVM = virCPUDataCheckFeature(data, "svm"); if (hasSVM < 0) goto cleanup; *hasHwVirt = hasSVM > 0 ? true : false; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 82d1621..e3a6a34 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -1605,7 +1605,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, NULL, NULL, NULL, NULL) < 0) goto cleanup; - is_32bit = (cpuHasFeature(cpuData, "lm") != 1); + is_32bit = (virCPUDataCheckFeature(cpuData, "lm") != 1); cpuDataFree(cpuData); } else if (model) { is_32bit = STREQ(model, "qemu32"); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d76d0c0..72046df 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3702,7 +3702,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, } if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_TRISTATE_SWITCH_ON) { - if (!cpuHasFeature(guestcpu, VIR_CPU_x86_KVM_PV_UNHALT)) { + if (!virCPUDataCheckFeature(guestcpu, VIR_CPU_x86_KVM_PV_UNHALT)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("host doesn't support paravirtual spinlocks")); goto cleanup; @@ -3715,7 +3715,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, if (virAsprintf(&cpuFeature, "__kvm_hv_%s", virDomainHypervTypeToString(i)) < 0) goto cleanup; - if (!cpuHasFeature(guestcpu, cpuFeature)) { + if (!virCPUDataCheckFeature(guestcpu, cpuFeature)) { switch ((virDomainHyperv) i) { case VIR_DOMAIN_HYPERV_RELAXED: case VIR_DOMAIN_HYPERV_VAPIC: @@ -3751,7 +3751,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, continue; if (STREQ(feature->name, "invtsc") && - !cpuHasFeature(guestcpu, feature->name)) { + !virCPUDataCheckFeature(guestcpu, feature->name)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("host doesn't support invariant TSC")); goto cleanup; @@ -4495,8 +4495,8 @@ qemuProcessStartValidateGuestCPU(virDomainObjPtr vm, case VIR_CPU_COMPARE_INCOMPATIBLE: if (cpuEncode(host->arch, host, NULL, &hostData, NULL, NULL, NULL, NULL) == 0 && - (!cpuHasFeature(hostData, "hle") || - !cpuHasFeature(hostData, "rtm")) && + (!virCPUDataCheckFeature(hostData, "hle") || + !virCPUDataCheckFeature(hostData, "rtm")) && (STREQ_NULLABLE(cpu->model, "Haswell") || STREQ_NULLABLE(cpu->model, "Broadwell"))) noTSX = true; diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 8736976..4222f4e 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -100,9 +100,9 @@ vmwareCapsInit(void) * - Host CPU is x86_64 with virtualization extensions */ if (caps->host.arch == VIR_ARCH_X86_64 || - (cpuHasFeature(data, "lm") && - (cpuHasFeature(data, "vmx") || - cpuHasFeature(data, "svm")))) { + (virCPUDataCheckFeature(data, "lm") && + (virCPUDataCheckFeature(data, "vmx") || + virCPUDataCheckFeature(data, "svm")))) { if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, diff --git a/tests/cputest.c b/tests/cputest.c index e6696e9..ce8f8c0 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -430,7 +430,7 @@ cpuTestHasFeature(const void *arg) NULL, NULL, NULL, NULL) < 0) goto cleanup; - result = cpuHasFeature(hostData, data->name); + result = virCPUDataCheckFeature(hostData, data->name); if (data->result == -1) virResetLastError(); -- 2.10.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list