mirror of
https://github.com/libvirt/libvirt.git
synced 2026-07-29 23:58:02 -05:00
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:
+4
-11
@@ -192,34 +192,27 @@ virCPUCompare(virArch arch,
|
|||||||
* @cpu: CPU definition stub to be filled in
|
* @cpu: CPU definition stub to be filled in
|
||||||
* @data: internal CPU data to be decoded into @cpu definition
|
* @data: internal CPU data to be decoded into @cpu definition
|
||||||
* @models: list of CPU models that can be considered when decoding @data
|
* @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
|
* 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,
|
* 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
|
* 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
|
* @models list is NULL, all models supported by libvirt will be considered
|
||||||
* when decoding the data. In general, this function will select the model
|
* 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
|
* closest to the CPU specified by @data.
|
||||||
* which case the @preferred model will be used as long as it is compatible
|
|
||||||
* with @data.
|
|
||||||
*
|
*
|
||||||
* For VIR_ARCH_I686 and VIR_ARCH_X86_64 architectures this means the computed
|
* 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.
|
* 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.
|
* Returns 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cpuDecode(virCPUDefPtr cpu,
|
cpuDecode(virCPUDefPtr cpu,
|
||||||
const virCPUData *data,
|
const virCPUData *data,
|
||||||
virDomainCapsCPUModelsPtr models,
|
virDomainCapsCPUModelsPtr models)
|
||||||
const char *preferred)
|
|
||||||
{
|
{
|
||||||
struct cpuArchDriver *driver;
|
struct cpuArchDriver *driver;
|
||||||
|
|
||||||
VIR_DEBUG("cpu=%p, data=%p, models=%p, preferred=%s",
|
VIR_DEBUG("cpu=%p, data=%p, models=%p", cpu, data, models);
|
||||||
cpu, data, models, NULLSTR(preferred));
|
|
||||||
if (models) {
|
if (models) {
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < models->nmodels; i++)
|
for (i = 0; i < models->nmodels; i++)
|
||||||
@@ -243,7 +236,7 @@ cpuDecode(virCPUDefPtr cpu,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return driver->decode(cpu, data, models, preferred);
|
return driver->decode(cpu, data, models);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -53,8 +53,7 @@ typedef virCPUCompareResult
|
|||||||
typedef int
|
typedef int
|
||||||
(*cpuArchDecode) (virCPUDefPtr cpu,
|
(*cpuArchDecode) (virCPUDefPtr cpu,
|
||||||
const virCPUData *data,
|
const virCPUData *data,
|
||||||
virDomainCapsCPUModelsPtr models,
|
virDomainCapsCPUModelsPtr models);
|
||||||
const char *preferred);
|
|
||||||
|
|
||||||
typedef int
|
typedef int
|
||||||
(*cpuArchEncode) (virArch arch,
|
(*cpuArchEncode) (virArch arch,
|
||||||
@@ -162,8 +161,7 @@ virCPUCompare(virArch arch,
|
|||||||
int
|
int
|
||||||
cpuDecode (virCPUDefPtr cpu,
|
cpuDecode (virCPUDefPtr cpu,
|
||||||
const virCPUData *data,
|
const virCPUData *data,
|
||||||
virDomainCapsCPUModelsPtr models,
|
virDomainCapsCPUModelsPtr models)
|
||||||
const char *preferred)
|
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
+2
-3
@@ -669,8 +669,7 @@ virCPUppc64Compare(virCPUDefPtr host,
|
|||||||
static int
|
static int
|
||||||
ppc64DriverDecode(virCPUDefPtr cpu,
|
ppc64DriverDecode(virCPUDefPtr cpu,
|
||||||
const virCPUData *data,
|
const virCPUData *data,
|
||||||
virDomainCapsCPUModelsPtr models,
|
virDomainCapsCPUModelsPtr models)
|
||||||
const char *preferred ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
struct ppc64_map *map;
|
struct ppc64_map *map;
|
||||||
@@ -741,7 +740,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu,
|
|||||||
#endif
|
#endif
|
||||||
data->pvr[0].mask = 0xfffffffful;
|
data->pvr[0].mask = 0xfffffffful;
|
||||||
|
|
||||||
ret = ppc64DriverDecode(cpu, cpuData, models, NULL);
|
ret = ppc64DriverDecode(cpu, cpuData, models);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCPUppc64DataFree(cpuData);
|
virCPUppc64DataFree(cpuData);
|
||||||
|
|||||||
+3
-4
@@ -1945,10 +1945,9 @@ x86Decode(virCPUDefPtr cpu,
|
|||||||
static int
|
static int
|
||||||
x86DecodeCPUData(virCPUDefPtr cpu,
|
x86DecodeCPUData(virCPUDefPtr cpu,
|
||||||
const virCPUData *data,
|
const virCPUData *data,
|
||||||
virDomainCapsCPUModelsPtr models,
|
virDomainCapsCPUModelsPtr models)
|
||||||
const char *preferred)
|
|
||||||
{
|
{
|
||||||
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)
|
cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = x86DecodeCPUData(cpu, cpuData, models, NULL);
|
ret = x86DecodeCPUData(cpu, cpuData, models);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCPUx86DataFree(cpuData);
|
virCPUx86DataFree(cpuData);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ libxlCapsInitCPU(virCapsPtr caps, libxl_physinfo *phy_info,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if (!(data = libxlCapsNodeData(cpu, phy_info->hw_cap, version)) ||
|
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");
|
VIR_WARN("Failed to initialize host cpu features");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3397,9 +3397,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
|
|||||||
if (virCPUx86DataSetSignature(data, sigFamily, sigModel) < 0)
|
if (virCPUx86DataSetSignature(data, sigFamily, sigModel) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (cpuDecode(cpu, data,
|
if (cpuDecode(cpu, data, virQEMUCapsGetCPUDefinitions(qemuCaps, type)) < 0)
|
||||||
virQEMUCapsGetCPUDefinitions(qemuCaps, type),
|
|
||||||
NULL) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|||||||
+1
-1
@@ -491,7 +491,7 @@ cpuTestCPUID(bool guest, const void *arg)
|
|||||||
cpu->type = VIR_CPU_TYPE_HOST;
|
cpu->type = VIR_CPU_TYPE_HOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpuDecode(cpu, hostData, NULL, NULL) < 0)
|
if (cpuDecode(cpu, hostData, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virAsprintf(&result, "cpuid-%s-%s",
|
if (virAsprintf(&result, "cpuid-%s-%s",
|
||||||
|
|||||||
Reference in New Issue
Block a user