mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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
|
* @data: internal CPU representation
|
||||||
* @feature: feature to be checked for
|
* @feature: feature to be checked for
|
||||||
@ -659,8 +659,8 @@ virCPUUpdate(virArch arch,
|
|||||||
* -1 on error.
|
* -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cpuHasFeature(const virCPUData *data,
|
virCPUDataCheckFeature(const virCPUData *data,
|
||||||
const char *feature)
|
const char *feature)
|
||||||
{
|
{
|
||||||
struct cpuArchDriver *driver;
|
struct cpuArchDriver *driver;
|
||||||
|
|
||||||
@ -669,14 +669,14 @@ cpuHasFeature(const virCPUData *data,
|
|||||||
if ((driver = cpuGetSubDriver(data->arch)) == NULL)
|
if ((driver = cpuGetSubDriver(data->arch)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (driver->hasFeature == NULL) {
|
if (!driver->dataCheckFeature) {
|
||||||
virReportError(VIR_ERR_NO_SUPPORT,
|
virReportError(VIR_ERR_NO_SUPPORT,
|
||||||
_("cannot check guest CPU data for %s architecture"),
|
_("cannot check guest CPU data for %s architecture"),
|
||||||
virArchToString(data->arch));
|
virArchToString(data->arch));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return driver->hasFeature(data, feature);
|
return driver->dataCheckFeature(data, feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ typedef int
|
|||||||
const virCPUDef *host);
|
const virCPUDef *host);
|
||||||
|
|
||||||
typedef int
|
typedef int
|
||||||
(*cpuArchHasFeature) (const virCPUData *data,
|
(*virCPUArchDataCheckFeature)(const virCPUData *data,
|
||||||
const char *feature);
|
const char *feature);
|
||||||
|
|
||||||
typedef char *
|
typedef char *
|
||||||
(*cpuArchDataFormat)(const virCPUData *data);
|
(*cpuArchDataFormat)(const virCPUData *data);
|
||||||
@ -120,7 +120,7 @@ struct cpuArchDriver {
|
|||||||
cpuArchGuestData guestData;
|
cpuArchGuestData guestData;
|
||||||
cpuArchBaseline baseline;
|
cpuArchBaseline baseline;
|
||||||
virCPUArchUpdate update;
|
virCPUArchUpdate update;
|
||||||
cpuArchHasFeature hasFeature;
|
virCPUArchDataCheckFeature dataCheckFeature;
|
||||||
cpuArchDataFormat dataFormat;
|
cpuArchDataFormat dataFormat;
|
||||||
cpuArchDataParse dataParse;
|
cpuArchDataParse dataParse;
|
||||||
cpuArchGetModels getModels;
|
cpuArchGetModels getModels;
|
||||||
@ -194,8 +194,8 @@ virCPUUpdate(virArch arch,
|
|||||||
ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int
|
int
|
||||||
cpuHasFeature(const virCPUData *data,
|
virCPUDataCheckFeature(const virCPUData *data,
|
||||||
const char *feature)
|
const char *feature)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,5 +131,4 @@ struct cpuArchDriver cpuDriverArm = {
|
|||||||
.guestData = armGuestData,
|
.guestData = armGuestData,
|
||||||
.baseline = armBaseline,
|
.baseline = armBaseline,
|
||||||
.update = virCPUarmUpdate,
|
.update = virCPUarmUpdate,
|
||||||
.hasFeature = NULL,
|
|
||||||
};
|
};
|
||||||
|
@ -910,6 +910,5 @@ struct cpuArchDriver cpuDriverPPC64 = {
|
|||||||
.guestData = ppc64DriverGuestData,
|
.guestData = ppc64DriverGuestData,
|
||||||
.baseline = ppc64DriverBaseline,
|
.baseline = ppc64DriverBaseline,
|
||||||
.update = virCPUppc64Update,
|
.update = virCPUppc64Update,
|
||||||
.hasFeature = NULL,
|
|
||||||
.getModels = ppc64DriverGetModels,
|
.getModels = ppc64DriverGetModels,
|
||||||
};
|
};
|
||||||
|
@ -83,5 +83,4 @@ struct cpuArchDriver cpuDriverS390 = {
|
|||||||
.guestData = NULL,
|
.guestData = NULL,
|
||||||
.baseline = NULL,
|
.baseline = NULL,
|
||||||
.update = NULL,
|
.update = NULL,
|
||||||
.hasFeature = NULL,
|
|
||||||
};
|
};
|
||||||
|
@ -2602,8 +2602,8 @@ virCPUx86Update(virCPUDefPtr guest,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
x86HasFeature(const virCPUData *data,
|
virCPUx86DataCheckFeature(const virCPUData *data,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
virCPUx86MapPtr map;
|
virCPUx86MapPtr map;
|
||||||
|
|
||||||
@ -2709,7 +2709,7 @@ struct cpuArchDriver cpuDriverX86 = {
|
|||||||
.guestData = x86GuestData,
|
.guestData = x86GuestData,
|
||||||
.baseline = x86Baseline,
|
.baseline = x86Baseline,
|
||||||
.update = virCPUx86Update,
|
.update = virCPUx86Update,
|
||||||
.hasFeature = x86HasFeature,
|
.dataCheckFeature = virCPUx86DataCheckFeature,
|
||||||
.dataFormat = x86CPUDataFormat,
|
.dataFormat = x86CPUDataFormat,
|
||||||
.dataParse = x86CPUDataParse,
|
.dataParse = x86CPUDataParse,
|
||||||
.getModels = x86GetModels,
|
.getModels = x86GetModels,
|
||||||
|
@ -979,8 +979,8 @@ cpuDecode;
|
|||||||
cpuEncode;
|
cpuEncode;
|
||||||
cpuGetModels;
|
cpuGetModels;
|
||||||
cpuGuestData;
|
cpuGuestData;
|
||||||
cpuHasFeature;
|
|
||||||
cpuNodeData;
|
cpuNodeData;
|
||||||
|
virCPUDataCheckFeature;
|
||||||
virCPUTranslate;
|
virCPUTranslate;
|
||||||
virCPUUpdate;
|
virCPUUpdate;
|
||||||
|
|
||||||
|
@ -6580,7 +6580,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|||||||
*/
|
*/
|
||||||
if ((def->os.arch == VIR_ARCH_X86_64 || def->os.arch == VIR_ARCH_I686) &&
|
if ((def->os.arch == VIR_ARCH_X86_64 || def->os.arch == VIR_ARCH_I686) &&
|
||||||
compareAgainstHost) {
|
compareAgainstHost) {
|
||||||
int hasSVM = cpuHasFeature(data, "svm");
|
int hasSVM = virCPUDataCheckFeature(data, "svm");
|
||||||
if (hasSVM < 0)
|
if (hasSVM < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
*hasHwVirt = hasSVM > 0 ? true : false;
|
*hasHwVirt = hasSVM > 0 ? true : false;
|
||||||
|
@ -1605,7 +1605,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
|
|||||||
NULL, NULL, NULL, NULL) < 0)
|
NULL, NULL, NULL, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
is_32bit = (cpuHasFeature(cpuData, "lm") != 1);
|
is_32bit = (virCPUDataCheckFeature(cpuData, "lm") != 1);
|
||||||
cpuDataFree(cpuData);
|
cpuDataFree(cpuData);
|
||||||
} else if (model) {
|
} else if (model) {
|
||||||
is_32bit = STREQ(model, "qemu32");
|
is_32bit = STREQ(model, "qemu32");
|
||||||
|
@ -3702,7 +3702,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_TRISTATE_SWITCH_ON) {
|
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",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("host doesn't support paravirtual spinlocks"));
|
_("host doesn't support paravirtual spinlocks"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3715,7 +3715,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
|
|||||||
if (virAsprintf(&cpuFeature, "__kvm_hv_%s",
|
if (virAsprintf(&cpuFeature, "__kvm_hv_%s",
|
||||||
virDomainHypervTypeToString(i)) < 0)
|
virDomainHypervTypeToString(i)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (!cpuHasFeature(guestcpu, cpuFeature)) {
|
if (!virCPUDataCheckFeature(guestcpu, cpuFeature)) {
|
||||||
switch ((virDomainHyperv) i) {
|
switch ((virDomainHyperv) i) {
|
||||||
case VIR_DOMAIN_HYPERV_RELAXED:
|
case VIR_DOMAIN_HYPERV_RELAXED:
|
||||||
case VIR_DOMAIN_HYPERV_VAPIC:
|
case VIR_DOMAIN_HYPERV_VAPIC:
|
||||||
@ -3751,7 +3751,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (STREQ(feature->name, "invtsc") &&
|
if (STREQ(feature->name, "invtsc") &&
|
||||||
!cpuHasFeature(guestcpu, feature->name)) {
|
!virCPUDataCheckFeature(guestcpu, feature->name)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("host doesn't support invariant TSC"));
|
_("host doesn't support invariant TSC"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -4530,8 +4530,8 @@ qemuProcessStartValidateGuestCPU(virDomainObjPtr vm,
|
|||||||
case VIR_CPU_COMPARE_INCOMPATIBLE:
|
case VIR_CPU_COMPARE_INCOMPATIBLE:
|
||||||
if (cpuEncode(host->arch, host, NULL, &hostData,
|
if (cpuEncode(host->arch, host, NULL, &hostData,
|
||||||
NULL, NULL, NULL, NULL) == 0 &&
|
NULL, NULL, NULL, NULL) == 0 &&
|
||||||
(!cpuHasFeature(hostData, "hle") ||
|
(!virCPUDataCheckFeature(hostData, "hle") ||
|
||||||
!cpuHasFeature(hostData, "rtm")) &&
|
!virCPUDataCheckFeature(hostData, "rtm")) &&
|
||||||
(STREQ_NULLABLE(cpu->model, "Haswell") ||
|
(STREQ_NULLABLE(cpu->model, "Haswell") ||
|
||||||
STREQ_NULLABLE(cpu->model, "Broadwell")))
|
STREQ_NULLABLE(cpu->model, "Broadwell")))
|
||||||
noTSX = true;
|
noTSX = true;
|
||||||
|
@ -100,9 +100,9 @@ vmwareCapsInit(void)
|
|||||||
* - Host CPU is x86_64 with virtualization extensions
|
* - Host CPU is x86_64 with virtualization extensions
|
||||||
*/
|
*/
|
||||||
if (caps->host.arch == VIR_ARCH_X86_64 ||
|
if (caps->host.arch == VIR_ARCH_X86_64 ||
|
||||||
(cpuHasFeature(data, "lm") &&
|
(virCPUDataCheckFeature(data, "lm") &&
|
||||||
(cpuHasFeature(data, "vmx") ||
|
(virCPUDataCheckFeature(data, "vmx") ||
|
||||||
cpuHasFeature(data, "svm")))) {
|
virCPUDataCheckFeature(data, "svm")))) {
|
||||||
|
|
||||||
if ((guest = virCapabilitiesAddGuest(caps,
|
if ((guest = virCapabilitiesAddGuest(caps,
|
||||||
VIR_DOMAIN_OSTYPE_HVM,
|
VIR_DOMAIN_OSTYPE_HVM,
|
||||||
|
@ -430,7 +430,7 @@ cpuTestHasFeature(const void *arg)
|
|||||||
NULL, NULL, NULL, NULL) < 0)
|
NULL, NULL, NULL, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
result = cpuHasFeature(hostData, data->name);
|
result = virCPUDataCheckFeature(hostData, data->name);
|
||||||
if (data->result == -1)
|
if (data->result == -1)
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user