cpu: Drop unused parameter from cpuDecode

The "preferred" parameter is not used by any caller of cpuDecode
anymore. It's only used internally in cpu_x86 to implement cpuBaseline.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Jiri Denemark 2017-09-26 10:24:05 +02:00
parent fd885a06a0
commit a62dca833e
7 changed files with 14 additions and 27 deletions

View File

@ -192,34 +192,27 @@ virCPUCompare(virArch arch,
* @cpu: CPU definition stub to be filled in
* @data: internal CPU data to be decoded into @cpu definition
* @models: list of CPU models that can be considered when decoding @data
* @preferred: CPU models that should be used if possible
*
* Decodes internal CPU data into a CPU definition consisting of a CPU model
* and a list of CPU features. The @cpu model stub is supposed to have arch,
* type, match and fallback members set, this function will add the rest. If
* @models list is NULL, all models supported by libvirt will be considered
* when decoding the data. In general, this function will select the model
* closest to the CPU specified by @data unless @preferred is non-NULL, in
* which case the @preferred model will be used as long as it is compatible
* with @data.
* closest to the CPU specified by @data.
*
* For VIR_ARCH_I686 and VIR_ARCH_X86_64 architectures this means the computed
* CPU definition will have the shortest possible list of additional features.
* When @preferred is non-NULL, the @preferred model will be used even if
* other models would result in a shorter list of additional features.
*
* Returns 0 on success, -1 on error.
*/
int
cpuDecode(virCPUDefPtr cpu,
const virCPUData *data,
virDomainCapsCPUModelsPtr models,
const char *preferred)
virDomainCapsCPUModelsPtr models)
{
struct cpuArchDriver *driver;
VIR_DEBUG("cpu=%p, data=%p, models=%p, preferred=%s",
cpu, data, models, NULLSTR(preferred));
VIR_DEBUG("cpu=%p, data=%p, models=%p", cpu, data, models);
if (models) {
size_t i;
for (i = 0; i < models->nmodels; i++)
@ -243,7 +236,7 @@ cpuDecode(virCPUDefPtr cpu,
return -1;
}
return driver->decode(cpu, data, models, preferred);
return driver->decode(cpu, data, models);
}

View File

@ -53,8 +53,7 @@ typedef virCPUCompareResult
typedef int
(*cpuArchDecode) (virCPUDefPtr cpu,
const virCPUData *data,
virDomainCapsCPUModelsPtr models,
const char *preferred);
virDomainCapsCPUModelsPtr models);
typedef int
(*cpuArchEncode) (virArch arch,
@ -162,8 +161,7 @@ virCPUCompare(virArch arch,
int
cpuDecode (virCPUDefPtr cpu,
const virCPUData *data,
virDomainCapsCPUModelsPtr models,
const char *preferred)
virDomainCapsCPUModelsPtr models)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int

View File

@ -669,8 +669,7 @@ virCPUppc64Compare(virCPUDefPtr host,
static int
ppc64DriverDecode(virCPUDefPtr cpu,
const virCPUData *data,
virDomainCapsCPUModelsPtr models,
const char *preferred ATTRIBUTE_UNUSED)
virDomainCapsCPUModelsPtr models)
{
int ret = -1;
struct ppc64_map *map;
@ -741,7 +740,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu,
#endif
data->pvr[0].mask = 0xfffffffful;
ret = ppc64DriverDecode(cpu, cpuData, models, NULL);
ret = ppc64DriverDecode(cpu, cpuData, models);
cleanup:
virCPUppc64DataFree(cpuData);

View File

@ -1945,10 +1945,9 @@ x86Decode(virCPUDefPtr cpu,
static int
x86DecodeCPUData(virCPUDefPtr cpu,
const virCPUData *data,
virDomainCapsCPUModelsPtr models,
const char *preferred)
virDomainCapsCPUModelsPtr models)
{
return x86Decode(cpu, &data->data.x86, models, preferred, false);
return x86Decode(cpu, &data->data.x86, models, NULL, false);
}
@ -2412,7 +2411,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
goto cleanup;
ret = x86DecodeCPUData(cpu, cpuData, models, NULL);
ret = x86DecodeCPUData(cpu, cpuData, models);
cleanup:
virCPUx86DataFree(cpuData);

View File

@ -192,7 +192,7 @@ libxlCapsInitCPU(virCapsPtr caps, libxl_physinfo *phy_info,
ret = 0;
if (!(data = libxlCapsNodeData(cpu, phy_info->hw_cap, version)) ||
cpuDecode(cpu, data, NULL, NULL) < 0) {
cpuDecode(cpu, data, NULL) < 0) {
VIR_WARN("Failed to initialize host cpu features");
goto error;
}

View File

@ -3397,9 +3397,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
if (virCPUx86DataSetSignature(data, sigFamily, sigModel) < 0)
goto cleanup;
if (cpuDecode(cpu, data,
virQEMUCapsGetCPUDefinitions(qemuCaps, type),
NULL) < 0)
if (cpuDecode(cpu, data, virQEMUCapsGetCPUDefinitions(qemuCaps, type)) < 0)
goto cleanup;
ret = 0;

View File

@ -491,7 +491,7 @@ cpuTestCPUID(bool guest, const void *arg)
cpu->type = VIR_CPU_TYPE_HOST;
}
if (cpuDecode(cpu, hostData, NULL, NULL) < 0)
if (cpuDecode(cpu, hostData, NULL) < 0)
goto cleanup;
if (virAsprintf(&result, "cpuid-%s-%s",