* @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++)
return -1;
}
- return driver->decode(cpu, data, models, preferred);
+ return driver->decode(cpu, data, models);
}
typedef int
(*cpuArchDecode) (virCPUDefPtr cpu,
const virCPUData *data,
- virDomainCapsCPUModelsPtr models,
- const char *preferred);
+ virDomainCapsCPUModelsPtr models);
typedef int
(*cpuArchEncode) (virArch arch,
int
cpuDecode (virCPUDefPtr cpu,
const virCPUData *data,
- virDomainCapsCPUModelsPtr models,
- const char *preferred)
+ virDomainCapsCPUModelsPtr models)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int
static int
ppc64DriverDecode(virCPUDefPtr cpu,
const virCPUData *data,
- virDomainCapsCPUModelsPtr models,
- const char *preferred ATTRIBUTE_UNUSED)
+ virDomainCapsCPUModelsPtr models)
{
int ret = -1;
struct ppc64_map *map;
#endif
data->pvr[0].mask = 0xfffffffful;
- ret = ppc64DriverDecode(cpu, cpuData, models, NULL);
+ ret = ppc64DriverDecode(cpu, cpuData, models);
cleanup:
virCPUppc64DataFree(cpuData);
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);
}
cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
goto cleanup;
- ret = x86DecodeCPUData(cpu, cpuData, models, NULL);
+ ret = x86DecodeCPUData(cpu, cpuData, models);
cleanup:
virCPUx86DataFree(cpuData);
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;
}
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;
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",