It really doesn't belong to the generic CPU driver. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/cpu/cpu_x86.c | 16 ++-------------- src/qemu/qemu_capabilities.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index e0987c4..237fa40 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2558,22 +2558,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) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f70a36c..187d4c1 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2859,6 +2859,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) @@ -2877,7 +2890,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; } -- 2.9.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list