Move CMT feature filtering to QEMU driver

It really doesn't belong to the generic CPU driver.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-07-21 17:02:37 +02:00
parent 7ce711a30e
commit c944a63461
2 changed files with 17 additions and 15 deletions

View File

@ -2559,22 +2559,10 @@ x86UpdateHostModel(virCPUDefPtr guest,
/* Remove non-migratable features by default */
updated->type = VIR_CPU_TYPE_GUEST;
updated->mode = VIR_CPU_MODE_CUSTOM;
if (virCPUDefCopyModel(updated, host, true) < 0)
if (virCPUDefCopyModelFilter(updated, host, true,
x86FeatureIsMigratable, map) < 0)
goto cleanup;
i = 0;
while (i < updated->nfeatures) {
if (x86FeatureIsMigratable(updated->features[i].name, map) &&
STRNEQ(updated->features[i].name, "cmt") &&
STRNEQ(updated->features[i].name, "mbm_total") &&
STRNEQ(updated->features[i].name, "mbm_local")) {
i++;
} else {
VIR_FREE(updated->features[i].name);
VIR_DELETE_ELEMENT_INPLACE(updated->features, i, updated->nfeatures);
}
}
if (guest->vendor_id) {
VIR_FREE(updated->vendor_id);
if (VIR_STRDUP(updated->vendor_id, guest->vendor_id) < 0)

View File

@ -2947,6 +2947,19 @@ int virQEMUCapsProbeQMP(virQEMUCapsPtr qemuCaps,
}
static bool
virQEMUCapsCPUFilterFeatures(const char *name,
void *opaque ATTRIBUTE_UNUSED)
{
if (STREQ(name, "cmt") ||
STREQ(name, "mbm_total") ||
STREQ(name, "mbm_local"))
return false;
return true;
}
void
virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
virCapsHostPtr host)
@ -2965,7 +2978,8 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
cpu->mode = VIR_CPU_MODE_CUSTOM;
cpu->match = VIR_CPU_MATCH_EXACT;
if (virCPUDefCopyModel(cpu, host->cpu, true) < 0)
if (virCPUDefCopyModelFilter(cpu, host->cpu, true,
virQEMUCapsCPUFilterFeatures, NULL) < 0)
goto error;
}