mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
cpu: Rename cpuHasFeature to virCPUDataCheckFeature
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
6b159239cc
commit
46c49a3004
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
@ -131,5 +131,4 @@ struct cpuArchDriver cpuDriverArm = {
|
||||
.guestData = armGuestData,
|
||||
.baseline = armBaseline,
|
||||
.update = virCPUarmUpdate,
|
||||
.hasFeature = NULL,
|
||||
};
|
||||
|
@ -910,6 +910,5 @@ struct cpuArchDriver cpuDriverPPC64 = {
|
||||
.guestData = ppc64DriverGuestData,
|
||||
.baseline = ppc64DriverBaseline,
|
||||
.update = virCPUppc64Update,
|
||||
.hasFeature = NULL,
|
||||
.getModels = ppc64DriverGetModels,
|
||||
};
|
||||
|
@ -83,5 +83,4 @@ struct cpuArchDriver cpuDriverS390 = {
|
||||
.guestData = NULL,
|
||||
.baseline = NULL,
|
||||
.update = NULL,
|
||||
.hasFeature = NULL,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -979,8 +979,8 @@ cpuDecode;
|
||||
cpuEncode;
|
||||
cpuGetModels;
|
||||
cpuGuestData;
|
||||
cpuHasFeature;
|
||||
cpuNodeData;
|
||||
virCPUDataCheckFeature;
|
||||
virCPUTranslate;
|
||||
virCPUUpdate;
|
||||
|
||||
|
@ -6580,7 +6580,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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
@ -4530,8 +4530,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;
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user