[libvirt PATCH 00/39] Distinguish Cascadelake-Server from Skylake-Server

The signatures of these two CPU model differ only in stepping as both report family 6 and model 85. Skylake-Server uses stepping 4 or less and Cascadelake-Server uses stepping 5..7. https://bugzilla.redhat.com/show_bug.cgi?id=1761678 Jiri Denemark (39): cpu_x86: Drop noTSX hint for incompatible CPUs cpu_x86: Use glib allocation for virCPU{,x86}Data cpu_x86: Use glib allocation for virCPUx86Vendor cpu_x86: Use glib allocation for virCPUx86Feature cpu_x86: Use glib allocation for virCPUx86Model cpu_x86: Use glib allocation for virCPUx86Map cpu_x86: Use glib allocation in virCPUx86GetModels cpu_x86: Use g_auto* in x86DataToCPU cpu_x86: Use g_auto* in x86VendorParse cpu_x86: Use g_auto* in x86FeatureParse cpu_x86: Use g_auto* in x86ModelFromCPU cpu_x86: Use g_auto* in x86ModelParse cpu_x86: Use g_auto* in virCPUx86LoadMap cpu_x86: Use g_auto* in virCPUx86DataParse cpu_x86: Use g_auto* in x86Compute cpu_x86: Use g_auto* in virCPUx86Compare cpu_x86: Use g_auto* in x86Decode cpu_x86: Use g_auto* in x86EncodePolicy cpu_x86: Use g_auto* in x86Encode cpu_x86: Use g_auto* in virCPUx86CheckFeature cpu_x86: Use g_auto* in virCPUx86GetHost cpu_x86: Use g_auto* in virCPUx86Baseline cpu_x86: Use g_auto* in x86UpdateHostModel cpu_x86: Use g_auto* in virCPUx86Update cpu_x86: Use g_auto* in virCPUx86UpdateLive cpu_x86: Use g_auto* in virCPUx86Translate cpu_x86: Use g_auto* in virCPUx86ExpandFeatures cpu_x86: Use g_auto* in virCPUx86CopyMigratable cpu_x86: Move and rename x86ModelCopySignatures cpu_x86: Move and rename x86ModelHasSignature cpu_x86: Move and rename x86FormatSignatures cpu_x86: Introduce virCPUx86SignaturesFree cpu_x86: Introduce virCPUx86SignatureFromCPUID cpu_x86: Replace 32b signatures in virCPUx86Model with a struct cpu_x86: Don't check return value of x86ModelCopy cpu_x86: Add support for stepping part of CPU signature cputest: Add data for Intel(R) Xeon(R) Platinum 9242 CPU cputest: Add data for Intel(R) Xeon(R) Gold 6130 CPU cpu_map: Distinguish Cascadelake-Server from Skylake-Server src/cpu/cpu_x86.c | 936 +++++------ src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 2 +- src/cpu_map/x86_Cascadelake-Server.xml | 2 +- src/cpu_map/x86_Skylake-Server-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server.xml | 2 +- tests/cputest.c | 2 + .../x86_64-cpuid-Xeon-Gold-6130-disabled.xml | 7 + .../x86_64-cpuid-Xeon-Gold-6130-enabled.xml | 9 + .../x86_64-cpuid-Xeon-Gold-6130-guest.xml | 34 + .../x86_64-cpuid-Xeon-Gold-6130-host.xml | 35 + .../x86_64-cpuid-Xeon-Gold-6130-json.xml | 17 + .../x86_64-cpuid-Xeon-Gold-6130.json | 1201 ++++++++++++++ .../x86_64-cpuid-Xeon-Gold-6130.sig | 4 + .../x86_64-cpuid-Xeon-Gold-6130.xml | 54 + ...6_64-cpuid-Xeon-Platinum-9242-disabled.xml | 7 + ...86_64-cpuid-Xeon-Platinum-9242-enabled.xml | 10 + .../x86_64-cpuid-Xeon-Platinum-9242-guest.xml | 38 + .../x86_64-cpuid-Xeon-Platinum-9242-host.xml | 39 + .../x86_64-cpuid-Xeon-Platinum-9242-json.xml | 21 + .../x86_64-cpuid-Xeon-Platinum-9242.json | 1405 +++++++++++++++++ .../x86_64-cpuid-Xeon-Platinum-9242.sig | 4 + .../x86_64-cpuid-Xeon-Platinum-9242.xml | 68 + 23 files changed, 3372 insertions(+), 529 deletions(-) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml -- 2.26.0

The hint was introduced a long time ago when broken TSX implementation was found in Haswell and Broadwell CPUs. Since then many more CPUs with TSX were introduced and and disabled due to TAA vulnerability. Thus the hint is not very useful and I think removing it is a better choice then updating it to cover all current noTSX models. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ce15bb0454..eeb16c2763 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1937,7 +1937,6 @@ virCPUx86Compare(virCPUDefPtr host, bool failIncompatible) { virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; - virCPUx86MapPtr map; virCPUx86ModelPtr model = NULL; char *message = NULL; @@ -1954,41 +1953,12 @@ virCPUx86Compare(virCPUDefPtr host, ret = x86Compute(host, cpu, NULL, &message); - if (ret == VIR_CPU_COMPARE_INCOMPATIBLE) { - bool noTSX = false; - - if (STREQ_NULLABLE(cpu->model, "Haswell") || - STREQ_NULLABLE(cpu->model, "Broadwell")) { - if (!(map = virCPUx86GetMap())) - goto cleanup; - - if (!(model = x86ModelFromCPU(cpu, map, -1))) - goto cleanup; - - noTSX = !x86FeatureInData("hle", &model->data, map) || - !x86FeatureInData("rtm", &model->data, map); - } - - if (failIncompatible) { - ret = VIR_CPU_COMPARE_ERROR; - if (message) { - if (noTSX) { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, - _("%s; try using '%s-noTSX' CPU model"), - message, cpu->model); - } else { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); - } - } else { - if (noTSX) { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, - _("try using '%s-noTSX' CPU model"), - cpu->model); - } else { - virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); - } - } - } + if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) { + ret = VIR_CPU_COMPARE_ERROR; + if (message) + virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); + else + virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); } cleanup: -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
The hint was introduced a long time ago when broken TSX implementation was found in Haswell and Broadwell CPUs. Since then many more CPUs with TSX were introduced and and disabled due to TAA vulnerability.
Thus the hint is not very useful and I think removing it is a better choice then updating it to cover all current noTSX models.
This partially reverts: commit 7f127ded657b24e0e55cd5f3539ef5b2dc935908 cpu: Rework cpuCompare* APIs
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ce15bb0454..eeb16c2763 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1937,7 +1937,6 @@ virCPUx86Compare(virCPUDefPtr host, bool failIncompatible) { virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; - virCPUx86MapPtr map; virCPUx86ModelPtr model = NULL;
model is unused after this patch (that will cause a build error with clang after the g_auto conversion later in the series)
char *message = NULL;
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

On Tue, Apr 07, 2020 at 08:39:10 +0200, Ján Tomko wrote:
On a Friday in 2020, Jiri Denemark wrote:
The hint was introduced a long time ago when broken TSX implementation was found in Haswell and Broadwell CPUs. Since then many more CPUs with TSX were introduced and and disabled due to TAA vulnerability.
Thus the hint is not very useful and I think removing it is a better choice then updating it to cover all current noTSX models.
This partially reverts: commit 7f127ded657b24e0e55cd5f3539ef5b2dc935908 cpu: Rework cpuCompare* APIs
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ce15bb0454..eeb16c2763 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1937,7 +1937,6 @@ virCPUx86Compare(virCPUDefPtr host, bool failIncompatible) { virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; - virCPUx86MapPtr map; virCPUx86ModelPtr model = NULL;
model is unused after this patch (that will cause a build error with clang after the g_auto conversion later in the series)
Oh, I missed this. Fixed, thanks. Jirka

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index eeb16c2763..f0d9b7056a 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -468,8 +468,9 @@ virCPUx86DataClear(virCPUx86Data *data) if (!data) return; - VIR_FREE(data->items); + g_free(data->items); } +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virCPUx86Data, virCPUx86DataClear); static void @@ -481,21 +482,19 @@ virCPUx86DataFree(virCPUDataPtr data) virCPUx86DataClear(&data->data.x86); VIR_FREE(data); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUData, virCPUx86DataFree); -static int +static void x86DataCopy(virCPUx86Data *dst, const virCPUx86Data *src) { size_t i; - if (VIR_ALLOC_N(dst->items, src->len) < 0) - return -1; - + dst->items = g_new0(virCPUx86DataItem, src->len); dst->len = src->len; + for (i = 0; i < src->len; i++) dst->items[i] = src->items[i]; - - return 0; } @@ -781,9 +780,8 @@ x86DataToCPU(const virCPUx86Data *data, cpu->model = g_strdup(model->name); - if (x86DataCopy(©, data) < 0 || - x86DataCopy(&modelData, &model->data) < 0) - goto error; + x86DataCopy(©, data); + x86DataCopy(&modelData, &model->data); if ((vendor = x86DataToVendor(©, map))) cpu->vendor = g_strdup(vendor->name); @@ -1183,11 +1181,11 @@ x86ModelCopy(virCPUx86ModelPtr model) copy->name = g_strdup(model->name); - if (x86ModelCopySignatures(copy, model) < 0 || - x86DataCopy(©->data, &model->data) < 0) { + if (x86ModelCopySignatures(copy, model) < 0) { x86ModelFree(copy); return NULL; } + x86DataCopy(©->data, &model->data); copy->vendor = model->vendor; @@ -1415,10 +1413,11 @@ x86ModelParseAncestor(virCPUx86ModelPtr model, } model->vendor = ancestor->vendor; - if (x86ModelCopySignatures(model, ancestor) < 0 || - x86DataCopy(&model->data, &ancestor->data) < 0) + if (x86ModelCopySignatures(model, ancestor) < 0) return -1; + x86DataCopy(&model->data, &ancestor->data); + return 0; } @@ -1904,9 +1903,9 @@ x86Compute(virCPUDefPtr host, x86DataSubtract(&guest_model->data, &cpu_disable->data); - if (!(guestData = virCPUDataNew(arch)) || - x86DataCopy(&guestData->data.x86, &guest_model->data) < 0) + if (!(guestData = virCPUDataNew(arch))) goto error; + x86DataCopy(&guestData->data.x86, &guest_model->data); *guest = guestData; } @@ -2141,9 +2140,11 @@ x86Decode(virCPUDefPtr cpu, ssize_t i; int rc; - if (!cpuData || x86DataCopy(&data, cpuData) < 0) + if (!cpuData) return -1; + x86DataCopy(&data, cpuData); + if (!(map = virCPUx86GetMap())) goto cleanup; @@ -3057,13 +3058,11 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, !(modelDisabled = x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_DISABLE))) goto cleanup; - if (dataEnabled && - x86DataCopy(&enabled, &dataEnabled->data.x86) < 0) - goto cleanup; + if (dataEnabled) + x86DataCopy(&enabled, &dataEnabled->data.x86); - if (dataDisabled && - x86DataCopy(&disabled, &dataDisabled->data.x86) < 0) - goto cleanup; + if (dataDisabled) + x86DataCopy(&disabled, &dataDisabled->data.x86); for (i = 0; i < map->nfeatures; i++) { virCPUx86FeaturePtr feature = map->features[i]; -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index f0d9b7056a..6fad4af922 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -830,9 +830,10 @@ x86VendorFree(virCPUx86VendorPtr vendor) if (!vendor) return; - VIR_FREE(vendor->name); - VIR_FREE(vendor); + g_free(vendor->name); + g_free(vendor); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Vendor, x86VendorFree); static virCPUx86VendorPtr @@ -860,9 +861,7 @@ x86VendorParse(xmlXPathContextPtr ctxt, char *string = NULL; int ret = -1; - if (VIR_ALLOC(vendor) < 0) - goto cleanup; - + vendor = g_new0(virCPUx86Vendor, 1); vendor->name = g_strdup(name); if (x86VendorFind(map, vendor->name)) { -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6fad4af922..cfb8a2e4a5 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -893,28 +893,17 @@ x86VendorParse(xmlXPathContextPtr ctxt, } -static virCPUx86FeaturePtr -x86FeatureNew(void) -{ - virCPUx86FeaturePtr feature; - - if (VIR_ALLOC(feature) < 0) - return NULL; - - return feature; -} - - static void x86FeatureFree(virCPUx86FeaturePtr feature) { if (!feature) return; - VIR_FREE(feature->name); + g_free(feature->name); virCPUx86DataClear(&feature->data); - VIR_FREE(feature); + g_free(feature); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Feature, x86FeatureFree); static int @@ -1056,11 +1045,8 @@ x86FeatureParse(xmlXPathContextPtr ctxt, char *str = NULL; int ret = -1; - if (!(feature = x86FeatureNew())) - goto cleanup; - + feature = g_new0(virCPUx86Feature, 1); feature->migratable = true; - feature->name = g_strdup(name); if (x86FeatureFind(map, feature->name)) { -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index cfb8a2e4a5..4a0413db16 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1111,29 +1111,18 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } -static virCPUx86ModelPtr -x86ModelNew(void) -{ - virCPUx86ModelPtr model; - - if (VIR_ALLOC(model) < 0) - return NULL; - - return model; -} - - static void x86ModelFree(virCPUx86ModelPtr model) { if (!model) return; - VIR_FREE(model->name); - VIR_FREE(model->signatures); + g_free(model->name); + g_free(model->signatures); virCPUx86DataClear(&model->data); - VIR_FREE(model); + g_free(model); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); static int @@ -1161,9 +1150,7 @@ x86ModelCopy(virCPUx86ModelPtr model) { virCPUx86ModelPtr copy; - if (VIR_ALLOC(copy) < 0) - return NULL; - + copy = g_new0(virCPUx86Model, 1); copy->name = g_strdup(model->name); if (x86ModelCopySignatures(copy, model) < 0) { @@ -1216,7 +1203,7 @@ x86ModelFromCPU(const virCPUDef *cpu, if (cpu->type == VIR_CPU_TYPE_HOST && policy != VIR_CPU_FEATURE_REQUIRE && policy != -1) - return x86ModelNew(); + return g_new0(virCPUx86Model, 1); if (cpu->model && (policy == VIR_CPU_FEATURE_REQUIRE || policy == -1)) { @@ -1228,7 +1215,7 @@ x86ModelFromCPU(const virCPUDef *cpu, model = x86ModelCopy(model); } else { - model = x86ModelNew(); + model = g_new0(virCPUx86Model, 1); } if (!model) @@ -1540,9 +1527,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, goto cleanup; } - if (!(model = x86ModelNew())) - goto cleanup; - + model = g_new0(virCPUx86Model, 1); model->name = g_strdup(name); if (x86ModelParseDecode(model, ctxt) < 0) -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 4a0413db16..bcb87d6f93 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1566,23 +1566,24 @@ x86MapFree(virCPUx86MapPtr map) for (i = 0; i < map->nfeatures; i++) x86FeatureFree(map->features[i]); - VIR_FREE(map->features); + g_free(map->features); for (i = 0; i < map->nmodels; i++) x86ModelFree(map->models[i]); - VIR_FREE(map->models); + g_free(map->models); for (i = 0; i < map->nvendors; i++) x86VendorFree(map->vendors[i]); - VIR_FREE(map->vendors); + g_free(map->vendors); /* migrate_blockers only points to the features from map->features list, * which were already freed above */ - VIR_FREE(map->migrate_blockers); + g_free(map->migrate_blockers); - VIR_FREE(map); + g_free(map); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Map, x86MapFree); static virCPUx86MapPtr @@ -1590,8 +1591,7 @@ virCPUx86LoadMap(void) { virCPUx86MapPtr map; - if (VIR_ALLOC(map) < 0) - return NULL; + map = g_new0(virCPUx86Map, 1); if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, map) < 0) goto error; -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index bcb87d6f93..fce7a2b8c5 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3123,21 +3123,13 @@ virCPUx86GetModels(char ***models) return -1; if (models) { - if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) - goto error; + *models = g_new0(char *, map->nmodels + 1); for (i = 0; i < map->nmodels; i++) (*models)[i] = g_strdup(map->models[i]->name); } return map->nmodels; - - error: - if (models) { - virStringListFree(*models); - *models = NULL; - } - return -1; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index bcb87d6f93..fce7a2b8c5 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3123,21 +3123,13 @@ virCPUx86GetModels(char ***models) return -1;
if (models) { - if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) - goto error; + *models = g_new0(char *, map->nmodels + 1);
for (i = 0; i < map->nmodels; i++) (*models)[i] = g_strdup(map->models[i]->name); }
return map->nmodels; - - error:
Bye, error:
- if (models) { - virStringListFree(*models); - *models = NULL; - } - return -1; }
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index fce7a2b8c5..d0ef66f1e3 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -771,9 +771,9 @@ x86DataToCPU(const virCPUx86Data *data, virCPUx86MapPtr map, virDomainCapsCPUModelPtr hvModel) { - virCPUDefPtr cpu; - virCPUx86Data copy = VIR_CPU_X86_DATA_INIT; - virCPUx86Data modelData = VIR_CPU_X86_DATA_INIT; + g_autoptr(virCPUDef) cpu = NULL; + g_auto(virCPUx86Data) copy = VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) modelData = VIR_CPU_X86_DATA_INIT; virCPUx86VendorPtr vendor; cpu = virCPUDefNew(); @@ -801,7 +801,7 @@ x86DataToCPU(const virCPUx86Data *data, if ((feature = x86FeatureFind(map, *blocker)) && !x86DataIsSubset(©, &feature->data)) if (x86DataAdd(&modelData, &feature->data) < 0) - goto error; + return NULL; } } @@ -810,17 +810,9 @@ x86DataToCPU(const virCPUx86Data *data, if (x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_REQUIRE, ©, map) || x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, &modelData, map)) - goto error; - - cleanup: - virCPUx86DataClear(&modelData); - virCPUx86DataClear(©); - return cpu; + return NULL; - error: - virCPUDefFree(cpu); - cpu = NULL; - goto cleanup; + return g_steal_pointer(&cpu); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index d0ef66f1e3..a678bcde61 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -849,9 +849,8 @@ x86VendorParse(xmlXPathContextPtr ctxt, void *data) { virCPUx86MapPtr map = data; - virCPUx86VendorPtr vendor = NULL; - char *string = NULL; - int ret = -1; + g_autoptr(virCPUx86Vendor) vendor = NULL; + g_autofree char *string = NULL; vendor = g_new0(virCPUx86Vendor, 1); vendor->name = g_strdup(name); @@ -859,7 +858,7 @@ x86VendorParse(xmlXPathContextPtr ctxt, if (x86VendorFind(map, vendor->name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU vendor %s already defined"), vendor->name); - goto cleanup; + return -1; } string = virXPathString("string(@string)", ctxt); @@ -867,21 +866,16 @@ x86VendorParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing vendor string for CPU vendor %s"), vendor->name); - goto cleanup; + return -1; } if (virCPUx86VendorToData(string, &vendor->data) < 0) - goto cleanup; + return -1; if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0) - goto cleanup; - - ret = 0; + return -1; - cleanup: - x86VendorFree(vendor); - VIR_FREE(string); - return ret; + return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a678bcde61..d2bbcbd891 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1023,13 +1023,12 @@ x86FeatureParse(xmlXPathContextPtr ctxt, void *data) { virCPUx86MapPtr map = data; - xmlNodePtr *nodes = NULL; - virCPUx86FeaturePtr feature; + g_autofree xmlNodePtr *nodes = NULL; + g_autoptr(virCPUx86Feature) feature = NULL; virCPUx86DataItem item; size_t i; int n; - char *str = NULL; - int ret = -1; + g_autofree char *str = NULL; feature = g_new0(virCPUx86Feature, 1); feature->migratable = true; @@ -1038,7 +1037,7 @@ x86FeatureParse(xmlXPathContextPtr ctxt, if (x86FeatureFind(map, feature->name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU feature %s already defined"), feature->name); - goto cleanup; + return -1; } str = virXPathString("string(@migratable)", ctxt); @@ -1047,13 +1046,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt, n = virXPathNodeSet("./cpuid|./msr", ctxt, &nodes); if (n < 0) - goto cleanup; + return -1; if (n == 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing cpuid or msr element in feature %s"), feature->name); - goto cleanup; + return -1; } for (i = 0; i < n; i++) { @@ -1063,37 +1062,31 @@ x86FeatureParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid cpuid[%zu] in %s feature"), i, feature->name); - goto cleanup; + return -1; } } else { if (x86ParseMSR(ctxt, &item) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid msr[%zu] in %s feature"), i, feature->name); - goto cleanup; + return -1; } } if (virCPUx86DataAddItem(&feature->data, &item)) - goto cleanup; + return -1; } if (!feature->migratable && VIR_APPEND_ELEMENT_COPY(map->migrate_blockers, map->nblockers, feature) < 0) - goto cleanup; + return -1; if (VIR_APPEND_ELEMENT(map->features, map->nfeatures, feature) < 0) - goto cleanup; - - ret = 0; + return -1; - cleanup: - x86FeatureFree(feature); - VIR_FREE(nodes); - VIR_FREE(str); - return ret; + return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index d2bbcbd891..9455fd1440 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1173,7 +1173,7 @@ x86ModelFromCPU(const virCPUDef *cpu, virCPUx86MapPtr map, int policy) { - virCPUx86ModelPtr model = NULL; + g_autoptr(virCPUx86Model) model = NULL; size_t i; /* host CPU only contains required features; requesting other features @@ -1216,7 +1216,7 @@ x86ModelFromCPU(const virCPUDef *cpu, if (!(feature = x86FeatureFind(map, cpu->features[i].name))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU feature %s"), cpu->features[i].name); - goto error; + return NULL; } if (policy == -1) { @@ -1224,7 +1224,7 @@ x86ModelFromCPU(const virCPUDef *cpu, case VIR_CPU_FEATURE_FORCE: case VIR_CPU_FEATURE_REQUIRE: if (x86DataAdd(&model->data, &feature->data) < 0) - goto error; + return NULL; break; case VIR_CPU_FEATURE_DISABLE: @@ -1238,15 +1238,11 @@ x86ModelFromCPU(const virCPUDef *cpu, break; } } else if (x86DataAdd(&model->data, &feature->data) < 0) { - goto error; + return NULL; } } - return model; - - error: - x86ModelFree(model); - return NULL; + return g_steal_pointer(&model); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9455fd1440..fc94c029e4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1493,41 +1493,36 @@ x86ModelParse(xmlXPathContextPtr ctxt, void *data) { virCPUx86MapPtr map = data; - virCPUx86ModelPtr model = NULL; - int ret = -1; + g_autoptr(virCPUx86Model) model = NULL; if (x86ModelFind(map, name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Multiple definitions of CPU model '%s'"), name); - goto cleanup; + return -1; } model = g_new0(virCPUx86Model, 1); model->name = g_strdup(name); if (x86ModelParseDecode(model, ctxt) < 0) - goto cleanup; + return -1; if (x86ModelParseAncestor(model, ctxt, map) < 0) - goto cleanup; + return -1; if (x86ModelParseSignatures(model, ctxt) < 0) - goto cleanup; + return -1; if (x86ModelParseVendor(model, ctxt, map) < 0) - goto cleanup; + return -1; if (x86ModelParseFeatures(model, ctxt, map) < 0) - goto cleanup; + return -1; if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0) - goto cleanup; - - ret = 0; + return -1; - cleanup: - x86ModelFree(model); - return ret; + return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index fc94c029e4..ba269df66d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1559,18 +1559,14 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Map, x86MapFree); static virCPUx86MapPtr virCPUx86LoadMap(void) { - virCPUx86MapPtr map; + g_autoptr(virCPUx86Map) map = NULL; map = g_new0(virCPUx86Map, 1); if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, map) < 0) - goto error; - - return map; + return NULL; - error: - x86MapFree(map); - return NULL; + return g_steal_pointer(&map); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ba269df66d..6c3f9fc0be 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1636,8 +1636,8 @@ virCPUx86DataFormat(const virCPUData *data) static virCPUDataPtr virCPUx86DataParse(xmlXPathContextPtr ctxt) { - xmlNodePtr *nodes = NULL; - virCPUDataPtr cpuData = NULL; + g_autofree xmlNodePtr *nodes = NULL; + g_autoptr(virCPUData) cpuData = NULL; virCPUx86DataItem item; size_t i; int n; @@ -1646,11 +1646,11 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt) if (n <= 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no x86 CPU data found")); - goto error; + return NULL; } if (!(cpuData = virCPUDataNew(VIR_ARCH_X86_64))) - goto error; + return NULL; for (i = 0; i < n; i++) { ctxt->node = nodes[i]; @@ -1658,28 +1658,21 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt) if (x86ParseCPUID(ctxt, &item) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse cpuid[%zu]"), i); - goto error; + return NULL; } } else { if (x86ParseMSR(ctxt, &item) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse msr[%zu]"), i); - goto error; + return NULL; } } if (virCPUx86DataAdd(cpuData, &item) < 0) - goto error; + return NULL; } - cleanup: - VIR_FREE(nodes); - return cpuData; - - error: - virCPUx86DataFree(cpuData); - cpuData = NULL; - goto cleanup; + return g_steal_pointer(&cpuData); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 64 ++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6c3f9fc0be..6758fcc170 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1689,13 +1689,12 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt) char *flagsStr = NULL; \ if (!(flagsStr = x86FeatureNames(map, ", ", (CPU_DEF)))) { \ virReportOOMError(); \ - goto error; \ + return VIR_CPU_COMPARE_ERROR; \ } \ if (message) \ *message = g_strdup_printf("%s: %s", _(MSG), flagsStr); \ VIR_DEBUG("%s: %s", MSG, flagsStr); \ VIR_FREE(flagsStr); \ - ret = VIR_CPU_COMPARE_INCOMPATIBLE; \ } while (0) @@ -1706,15 +1705,15 @@ x86Compute(virCPUDefPtr host, char **message) { virCPUx86MapPtr map = NULL; - virCPUx86ModelPtr host_model = NULL; - virCPUx86ModelPtr cpu_force = NULL; - virCPUx86ModelPtr cpu_require = NULL; - virCPUx86ModelPtr cpu_optional = NULL; - virCPUx86ModelPtr cpu_disable = NULL; - virCPUx86ModelPtr cpu_forbid = NULL; - virCPUx86ModelPtr diff = NULL; - virCPUx86ModelPtr guest_model = NULL; - virCPUDataPtr guestData = NULL; + g_autoptr(virCPUx86Model) host_model = NULL; + g_autoptr(virCPUx86Model) cpu_force = NULL; + g_autoptr(virCPUx86Model) cpu_require = NULL; + g_autoptr(virCPUx86Model) cpu_optional = NULL; + g_autoptr(virCPUx86Model) cpu_disable = NULL; + g_autoptr(virCPUx86Model) cpu_forbid = NULL; + g_autoptr(virCPUx86Model) diff = NULL; + g_autoptr(virCPUx86Model) guest_model = NULL; + g_autoptr(virCPUData) guestData = NULL; virCPUCompareResult ret; virCPUx86CompareResult result; virArch arch; @@ -1764,13 +1763,13 @@ x86Compute(virCPUDefPtr host, !(cpu_optional = x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_OPTIONAL)) || !(cpu_disable = x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_DISABLE)) || !(cpu_forbid = x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_FORBID))) - goto error; + return VIR_CPU_COMPARE_ERROR; x86DataIntersect(&cpu_forbid->data, &host_model->data); if (!x86DataIsEmpty(&cpu_forbid->data)) { virX86CpuIncompatible(N_("Host CPU provides forbidden features"), &cpu_forbid->data); - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } /* first remove features that were inherited from the CPU model and were @@ -1785,20 +1784,20 @@ x86Compute(virCPUDefPtr host, virX86CpuIncompatible(N_("Host CPU does not provide required " "features"), &cpu_require->data); - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } - ret = VIR_CPU_COMPARE_IDENTICAL; - if (!(diff = x86ModelCopy(host_model))) - goto error; + return VIR_CPU_COMPARE_ERROR; x86DataSubtract(&diff->data, &cpu_optional->data); x86DataSubtract(&diff->data, &cpu_require->data); x86DataSubtract(&diff->data, &cpu_disable->data); x86DataSubtract(&diff->data, &cpu_force->data); - if (!x86DataIsEmpty(&diff->data)) + if (x86DataIsEmpty(&diff->data)) + ret = VIR_CPU_COMPARE_IDENTICAL; + else ret = VIR_CPU_COMPARE_SUPERSET; if (ret == VIR_CPU_COMPARE_SUPERSET @@ -1807,54 +1806,39 @@ x86Compute(virCPUDefPtr host, virX86CpuIncompatible(N_("Host CPU does not strictly match guest CPU: " "Extra features"), &diff->data); - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } if (guest) { if (!(guest_model = x86ModelCopy(host_model))) - goto error; + return VIR_CPU_COMPARE_ERROR; if (cpu->vendor && host_model->vendor && virCPUx86DataAddItem(&guest_model->data, &host_model->vendor->data) < 0) - goto error; + return VIR_CPU_COMPARE_ERROR; if (host_model->signatures && x86DataAddSignature(&guest_model->data, *host_model->signatures) < 0) - goto error; + return VIR_CPU_COMPARE_ERROR; if (cpu->type == VIR_CPU_TYPE_GUEST && cpu->match == VIR_CPU_MATCH_EXACT) x86DataSubtract(&guest_model->data, &diff->data); if (x86DataAdd(&guest_model->data, &cpu_force->data)) - goto error; + return VIR_CPU_COMPARE_ERROR; x86DataSubtract(&guest_model->data, &cpu_disable->data); if (!(guestData = virCPUDataNew(arch))) - goto error; + return VIR_CPU_COMPARE_ERROR; x86DataCopy(&guestData->data.x86, &guest_model->data); - *guest = guestData; + *guest = g_steal_pointer(&guestData); } - cleanup: - x86ModelFree(host_model); - x86ModelFree(diff); - x86ModelFree(cpu_force); - x86ModelFree(cpu_require); - x86ModelFree(cpu_optional); - x86ModelFree(cpu_disable); - x86ModelFree(cpu_forbid); - x86ModelFree(guest_model); - return ret; - - error: - virCPUx86DataFree(guestData); - ret = VIR_CPU_COMPARE_ERROR; - goto cleanup; } #undef virX86CpuIncompatible -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 64 ++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 40 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6c3f9fc0be..6758fcc170 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1689,13 +1689,12 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
The comment of this macro says: * RET: return code to set but there has been no RET parameter since the introduction of this comment in a2ba53cf18a9ad252a74a39f45ec3577923f50de
char *flagsStr = NULL; \ if (!(flagsStr = x86FeatureNames(map, ", ", (CPU_DEF)))) { \ virReportOOMError(); \ - goto error; \ + return VIR_CPU_COMPARE_ERROR; \ } \ if (message) \ *message = g_strdup_printf("%s: %s", _(MSG), flagsStr); \ VIR_DEBUG("%s: %s", MSG, flagsStr); \ VIR_FREE(flagsStr); \ - ret = VIR_CPU_COMPARE_INCOMPATIBLE; \ } while (0)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

On Tue, Apr 07, 2020 at 12:08:37 +0200, Ján Tomko wrote:
On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 64 ++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 40 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6c3f9fc0be..6758fcc170 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1689,13 +1689,12 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
The comment of this macro says: * RET: return code to set
OK, I squashed removal of this line to this patch since I'm touching the way this macro handles return values :-) Jirka

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6758fcc170..e4e21fbed4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1848,34 +1848,31 @@ virCPUx86Compare(virCPUDefPtr host, virCPUDefPtr cpu, bool failIncompatible) { - virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; - virCPUx86ModelPtr model = NULL; - char *message = NULL; + virCPUCompareResult ret; + g_autoptr(virCPUx86Model) model = NULL; + g_autofree char *message = NULL; if (!host || !host->model) { if (failIncompatible) { virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", _("unknown host CPU")); - } else { - VIR_WARN("unknown host CPU"); - ret = VIR_CPU_COMPARE_INCOMPATIBLE; + return VIR_CPU_COMPARE_ERROR; } - goto cleanup; + + VIR_WARN("unknown host CPU"); + return VIR_CPU_COMPARE_INCOMPATIBLE; } ret = x86Compute(host, cpu, NULL, &message); if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) { - ret = VIR_CPU_COMPARE_ERROR; if (message) virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); else virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); + return VIR_CPU_COMPARE_ERROR; } - cleanup: - VIR_FREE(message); - x86ModelFree(model); return ret; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 6758fcc170..e4e21fbed4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1848,34 +1848,31 @@ virCPUx86Compare(virCPUDefPtr host, virCPUDefPtr cpu, bool failIncompatible) { - virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; - virCPUx86ModelPtr model = NULL; - char *message = NULL; + virCPUCompareResult ret; + g_autoptr(virCPUx86Model) model = NULL;
As mentioned earlier, model is no longer used here.
+ g_autofree char *message = NULL;
if (!host || !host->model) { if (failIncompatible) { virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", _("unknown host CPU")); - } else { - VIR_WARN("unknown host CPU"); - ret = VIR_CPU_COMPARE_INCOMPATIBLE; + return VIR_CPU_COMPARE_ERROR; } - goto cleanup; + + VIR_WARN("unknown host CPU"); + return VIR_CPU_COMPARE_INCOMPATIBLE; }
ret = x86Compute(host, cpu, NULL, &message);
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index e4e21fbed4..26d872622e 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2034,15 +2034,14 @@ x86Decode(virCPUDefPtr cpu, const char *preferred, bool migratable) { - int ret = -1; virCPUx86MapPtr map; virCPUx86ModelPtr candidate; virCPUDefPtr cpuCandidate; virCPUx86ModelPtr model = NULL; - virCPUDefPtr cpuModel = NULL; - virCPUx86Data data = VIR_CPU_X86_DATA_INIT; - virCPUx86Data copy = VIR_CPU_X86_DATA_INIT; - virCPUx86Data features = VIR_CPU_X86_DATA_INIT; + g_autoptr(virCPUDef) cpuModel = NULL; + g_auto(virCPUx86Data) data = VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) copy = VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) features = VIR_CPU_X86_DATA_INIT; virCPUx86VendorPtr vendor; virDomainCapsCPUModelPtr hvModel = NULL; g_autofree char *sigs = NULL; @@ -2056,7 +2055,7 @@ x86Decode(virCPUDefPtr cpu, x86DataCopy(&data, cpuData); if (!(map = virCPUx86GetMap())) - goto cleanup; + return -1; vendor = x86DataToVendor(&data, map); signature = x86DataToSignature(&data); @@ -2075,7 +2074,7 @@ x86Decode(virCPUDefPtr cpu, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("CPU model %s is not supported by hypervisor"), preferred); - goto cleanup; + return -1; } else { VIR_WARN("Preferred CPU model %s not allowed by" " hypervisor; closest supported model will be" @@ -2098,7 +2097,7 @@ x86Decode(virCPUDefPtr cpu, } if (!(cpuCandidate = x86DataToCPU(&data, candidate, map, hvModel))) - goto cleanup; + return -1; cpuCandidate->type = cpu->type; if ((rc = x86DecodeUseCandidate(model, cpuModel, @@ -2117,7 +2116,7 @@ x86Decode(virCPUDefPtr cpu, if (!cpuModel) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot find suitable CPU model for given data")); - goto cleanup; + return -1; } /* Remove non-migratable features if requested @@ -2151,14 +2150,7 @@ x86Decode(virCPUDefPtr cpu, cpu->nfeatures_max = cpuModel->nfeatures_max; cpuModel->nfeatures_max = 0; - ret = 0; - - cleanup: - virCPUDefFree(cpuModel); - virCPUx86DataClear(&data); - virCPUx86DataClear(©); - virCPUx86DataClear(&features); - return ret; + return 0; } static int -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
Both copy and features are unused as of: commit d8b3dd16cb947cc16c0700c4836367b4fcb15525 cpu: Move feature expansion out of cpuBaseline Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 21292fa330..d3318a28da 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2039,8 +2039,6 @@ x86Decode(virCPUDefPtr cpu, virCPUx86ModelPtr model = NULL; g_autoptr(virCPUDef) cpuModel = NULL; g_auto(virCPUx86Data) data = VIR_CPU_X86_DATA_INIT; - g_auto(virCPUx86Data) copy = VIR_CPU_X86_DATA_INIT; - g_auto(virCPUx86Data) features = VIR_CPU_X86_DATA_INIT; virCPUx86VendorPtr vendor; virDomainCapsCPUModelPtr hvModel = NULL; g_autofree char *sigs = NULL;

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 26d872622e..ce43da2bfa 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2168,7 +2168,7 @@ x86EncodePolicy(virCPUx86Data *data, virCPUx86MapPtr map, virCPUFeaturePolicy policy) { - virCPUx86ModelPtr model; + g_autoptr(virCPUx86Model) model = NULL; if (!(model = x86ModelFromCPU(cpu, map, policy))) return -1; @@ -2176,7 +2176,6 @@ x86EncodePolicy(virCPUx86Data *data, *data = model->data; model->data.len = 0; model->data.items = NULL; - x86ModelFree(model); return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 51 +++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ce43da2bfa..431fbd8ec6 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2192,12 +2192,12 @@ x86Encode(virArch arch, virCPUDataPtr *vendor) { virCPUx86MapPtr map = NULL; - virCPUDataPtr data_forced = NULL; - virCPUDataPtr data_required = NULL; - virCPUDataPtr data_optional = NULL; - virCPUDataPtr data_disabled = NULL; - virCPUDataPtr data_forbidden = NULL; - virCPUDataPtr data_vendor = NULL; + g_autoptr(virCPUData) data_forced = NULL; + g_autoptr(virCPUData) data_required = NULL; + g_autoptr(virCPUData) data_optional = NULL; + g_autoptr(virCPUData) data_disabled = NULL; + g_autoptr(virCPUData) data_forbidden = NULL; + g_autoptr(virCPUData) data_vendor = NULL; if (forced) *forced = NULL; @@ -2213,37 +2213,37 @@ x86Encode(virArch arch, *vendor = NULL; if (!(map = virCPUx86GetMap())) - goto error; + return -1; if (forced && (!(data_forced = virCPUDataNew(arch)) || x86EncodePolicy(&data_forced->data.x86, cpu, map, VIR_CPU_FEATURE_FORCE) < 0)) - goto error; + return -1; if (required && (!(data_required = virCPUDataNew(arch)) || x86EncodePolicy(&data_required->data.x86, cpu, map, VIR_CPU_FEATURE_REQUIRE) < 0)) - goto error; + return -1; if (optional && (!(data_optional = virCPUDataNew(arch)) || x86EncodePolicy(&data_optional->data.x86, cpu, map, VIR_CPU_FEATURE_OPTIONAL) < 0)) - goto error; + return -1; if (disabled && (!(data_disabled = virCPUDataNew(arch)) || x86EncodePolicy(&data_disabled->data.x86, cpu, map, VIR_CPU_FEATURE_DISABLE) < 0)) - goto error; + return -1; if (forbidden && (!(data_forbidden = virCPUDataNew(arch)) || x86EncodePolicy(&data_forbidden->data.x86, cpu, map, VIR_CPU_FEATURE_FORBID) < 0)) - goto error; + return -1; if (vendor) { virCPUx86VendorPtr v = NULL; @@ -2251,39 +2251,30 @@ x86Encode(virArch arch, if (cpu->vendor && !(v = x86VendorFind(map, cpu->vendor))) { virReportError(VIR_ERR_OPERATION_FAILED, _("CPU vendor %s not found"), cpu->vendor); - goto error; + return -1; } if (!(data_vendor = virCPUDataNew(arch))) - goto error; + return -1; if (v && virCPUx86DataAdd(data_vendor, &v->data) < 0) - goto error; + return -1; } if (forced) - *forced = data_forced; + *forced = g_steal_pointer(&data_forced); if (required) - *required = data_required; + *required = g_steal_pointer(&data_required); if (optional) - *optional = data_optional; + *optional = g_steal_pointer(&data_optional); if (disabled) - *disabled = data_disabled; + *disabled = g_steal_pointer(&data_disabled); if (forbidden) - *forbidden = data_forbidden; + *forbidden = g_steal_pointer(&data_forbidden); if (vendor) - *vendor = data_vendor; + *vendor = g_steal_pointer(&data_vendor); return 0; - - error: - virCPUx86DataFree(data_forced); - virCPUx86DataFree(data_required); - virCPUx86DataFree(data_optional); - virCPUx86DataFree(data_disabled); - virCPUx86DataFree(data_forbidden); - virCPUx86DataFree(data_vendor); - return -1; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 51 +++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 30 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 431fbd8ec6..3b3a428ecd 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2282,21 +2282,16 @@ static int virCPUx86CheckFeature(const virCPUDef *cpu, const char *name) { - int ret = -1; virCPUx86MapPtr map; - virCPUx86ModelPtr model = NULL; + g_autoptr(virCPUx86Model) model = NULL; if (!(map = virCPUx86GetMap())) return -1; if (!(model = x86ModelFromCPU(cpu, map, -1))) - goto cleanup; - - ret = x86FeatureInData(name, &model->data, map); + return -1; - cleanup: - x86ModelFree(model); - return ret; + return x86FeatureInData(name, &model->data, map); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 3b3a428ecd..7bd19a1676 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2641,18 +2641,18 @@ static int virCPUx86GetHost(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) { - virCPUDataPtr cpuData = NULL; - int ret = -1; + g_autoptr(virCPUData) cpuData = NULL; + int ret; if (virCPUx86DriverInitialize() < 0) - goto cleanup; + return -1; if (!(cpuData = virCPUDataNew(archs[0]))) - goto cleanup; + return -1; if (cpuidSet(CPUX86_BASIC, cpuData) < 0 || cpuidSet(CPUX86_EXTENDED, cpuData) < 0) - goto cleanup; + return -1; /* Read the IA32_ARCH_CAPABILITIES MSR (0x10a) if supported. * This is best effort since there might be no way to read the MSR @@ -2672,7 +2672,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, }; if (virCPUx86DataAdd(cpuData, &item) < 0) - goto cleanup; + return -1; } } @@ -2688,8 +2688,6 @@ virCPUx86GetHost(virCPUDefPtr cpu, VIR_DEBUG("Host CPU does not support invariant TSC"); } - cleanup: - virCPUx86DataFree(cpuData); return ret; } #endif -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 7bd19a1676..ccbae3dabd 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2701,21 +2701,20 @@ virCPUx86Baseline(virCPUDefPtr *cpus, bool migratable) { virCPUx86MapPtr map = NULL; - virCPUx86ModelPtr base_model = NULL; - virCPUDefPtr cpu = NULL; + g_autoptr(virCPUx86Model) base_model = NULL; + g_autoptr(virCPUDef) cpu = NULL; size_t i; virCPUx86VendorPtr vendor = NULL; - virCPUx86ModelPtr model = NULL; bool outputVendor = true; const char *modelName; bool matchingNames = true; - virCPUDataPtr featData = NULL; + g_autoptr(virCPUData) featData = NULL; if (!(map = virCPUx86GetMap())) - goto error; + return NULL; if (!(base_model = x86ModelFromCPU(cpus[0], map, -1))) - goto error; + return NULL; cpu = virCPUDefNew(); @@ -2727,11 +2726,12 @@ virCPUx86Baseline(virCPUDefPtr *cpus, } else if (!(vendor = x86VendorFind(map, cpus[0]->vendor))) { virReportError(VIR_ERR_OPERATION_FAILED, _("Unknown CPU vendor %s"), cpus[0]->vendor); - goto error; + return NULL; } modelName = cpus[0]->model; for (i = 1; i < ncpus; i++) { + g_autoptr(virCPUx86Model) model = NULL; const char *vn = NULL; if (matchingNames && cpus[i]->model) { @@ -2744,14 +2744,14 @@ virCPUx86Baseline(virCPUDefPtr *cpus, } if (!(model = x86ModelFromCPU(cpus[i], map, -1))) - goto error; + return NULL; if (cpus[i]->vendor && model->vendor && STRNEQ(cpus[i]->vendor, model->vendor->name)) { virReportError(VIR_ERR_OPERATION_FAILED, _("CPU vendor %s of model %s differs from vendor %s"), model->vendor->name, model->name, cpus[i]->vendor); - goto error; + return NULL; } if (cpus[i]->vendor) { @@ -2767,30 +2767,28 @@ virCPUx86Baseline(virCPUDefPtr *cpus, if (!(vendor = x86VendorFind(map, vn))) { virReportError(VIR_ERR_OPERATION_FAILED, _("Unknown CPU vendor %s"), vn); - goto error; + return NULL; } } else if (STRNEQ(vendor->name, vn)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("CPU vendors do not match")); - goto error; + return NULL; } } x86DataIntersect(&base_model->data, &model->data); - x86ModelFree(model); - model = NULL; } if (features) { virCPUx86FeaturePtr feat; if (!(featData = virCPUDataNew(archs[0]))) - goto cleanup; + return NULL; for (i = 0; features[i]; i++) { if ((feat = x86FeatureFind(map, features[i])) && x86DataAdd(&featData->data.x86, &feat->data) < 0) - goto cleanup; + return NULL; } x86DataIntersect(&base_model->data, &featData->data.x86); @@ -2799,15 +2797,15 @@ virCPUx86Baseline(virCPUDefPtr *cpus, if (x86DataIsEmpty(&base_model->data)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("CPUs are incompatible")); - goto error; + return NULL; } if (vendor && virCPUx86DataAddItem(&base_model->data, &vendor->data) < 0) - goto error; + return NULL; if (x86Decode(cpu, &base_model->data, models, modelName, migratable) < 0) - goto error; + return NULL; if (STREQ_NULLABLE(cpu->model, modelName)) cpu->fallback = VIR_CPU_FALLBACK_FORBID; @@ -2815,17 +2813,7 @@ virCPUx86Baseline(virCPUDefPtr *cpus, if (!outputVendor) VIR_FREE(cpu->vendor); - cleanup: - x86ModelFree(base_model); - virCPUx86DataFree(featData); - - return cpu; - - error: - x86ModelFree(model); - virCPUDefFree(cpu); - cpu = NULL; - goto cleanup; + return g_steal_pointer(&cpu); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ccbae3dabd..9f6027ec5c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2821,17 +2821,16 @@ static int x86UpdateHostModel(virCPUDefPtr guest, const virCPUDef *host) { - virCPUDefPtr updated = NULL; + g_autoptr(virCPUDef) updated = NULL; size_t i; - int ret = -1; if (!(updated = virCPUDefCopyWithoutModel(host))) - goto cleanup; + return -1; updated->type = VIR_CPU_TYPE_GUEST; updated->mode = VIR_CPU_MODE_CUSTOM; if (virCPUDefCopyModel(updated, host, true) < 0) - goto cleanup; + return -1; if (guest->vendor_id) { VIR_FREE(updated->vendor_id); @@ -2842,18 +2841,15 @@ x86UpdateHostModel(virCPUDefPtr guest, if (virCPUDefUpdateFeature(updated, guest->features[i].name, guest->features[i].policy) < 0) - goto cleanup; + return -1; } virCPUDefStealModel(guest, updated, guest->mode == VIR_CPU_MODE_CUSTOM); guest->mode = VIR_CPU_MODE_CUSTOM; guest->match = VIR_CPU_MATCH_EXACT; - ret = 0; - cleanup: - virCPUDefFree(updated); - return ret; + return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9f6027ec5c..8da8b3ada2 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2857,9 +2857,8 @@ static int virCPUx86Update(virCPUDefPtr guest, const virCPUDef *host) { - virCPUx86ModelPtr model = NULL; + g_autoptr(virCPUx86Model) model = NULL; virCPUx86MapPtr map; - int ret = -1; size_t i; if (!host) { @@ -2872,14 +2871,14 @@ virCPUx86Update(virCPUDefPtr guest, return -1; if (!(model = x86ModelFromCPU(host, map, -1))) - goto cleanup; + return -1; for (i = 0; i < guest->nfeatures; i++) { if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) { int supported = x86FeatureInData(guest->features[i].name, &model->data, map); if (supported < 0) - goto cleanup; + return -1; else if (supported) guest->features[i].policy = VIR_CPU_FEATURE_REQUIRE; else @@ -2889,13 +2888,9 @@ virCPUx86Update(virCPUDefPtr guest, if (guest->mode == VIR_CPU_MODE_HOST_MODEL || guest->match == VIR_CPU_MATCH_MINIMUM) - ret = x86UpdateHostModel(guest, host); - else - ret = 0; + return x86UpdateHostModel(guest, host); - cleanup: - x86ModelFree(model); - return ret; + return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 8da8b3ada2..0be2cf517d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2901,26 +2901,25 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, { bool hostPassthrough = cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH; virCPUx86MapPtr map; - virCPUx86ModelPtr model = NULL; - virCPUx86ModelPtr modelDisabled = NULL; - virCPUx86Data enabled = VIR_CPU_X86_DATA_INIT; - virCPUx86Data disabled = VIR_CPU_X86_DATA_INIT; - virBuffer bufAdded = VIR_BUFFER_INITIALIZER; - virBuffer bufRemoved = VIR_BUFFER_INITIALIZER; - char *added = NULL; - char *removed = NULL; + g_autoptr(virCPUx86Model) model = NULL; + g_autoptr(virCPUx86Model) modelDisabled = NULL; + g_auto(virCPUx86Data) enabled = VIR_CPU_X86_DATA_INIT; + g_auto(virCPUx86Data) disabled = VIR_CPU_X86_DATA_INIT; + g_auto(virBuffer) bufAdded = VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) bufRemoved = VIR_BUFFER_INITIALIZER; + g_autofree char *added = NULL; + g_autofree char *removed = NULL; size_t i; - int ret = -1; if (!(map = virCPUx86GetMap())) return -1; if (!(model = x86ModelFromCPU(cpu, map, -1))) - goto cleanup; + return -1; if (hostPassthrough && !(modelDisabled = x86ModelFromCPU(cpu, map, VIR_CPU_FEATURE_DISABLE))) - goto cleanup; + return -1; if (dataEnabled) x86DataCopy(&enabled, &dataEnabled->data.x86); @@ -2945,7 +2944,7 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, virBufferAsprintf(&bufAdded, "%s,", feature->name); else if (virCPUDefUpdateFeature(cpu, feature->name, VIR_CPU_FEATURE_REQUIRE) < 0) - goto cleanup; + return -1; } if (x86DataIsSubset(&disabled, &feature->data) || @@ -2956,7 +2955,7 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, virBufferAsprintf(&bufRemoved, "%s,", feature->name); else if (virCPUDefUpdateFeature(cpu, feature->name, VIR_CPU_FEATURE_DISABLE) < 0) - goto cleanup; + return -1; } } @@ -2982,28 +2981,17 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, _("guest CPU doesn't match specification: " "missing features: %s"), removed); - goto cleanup; + return -1; } if (cpu->check == VIR_CPU_CHECK_FULL && !x86DataIsEmpty(&disabled)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("guest CPU doesn't match specification")); - goto cleanup; + return -1; } - ret = 0; - - cleanup: - x86ModelFree(model); - x86ModelFree(modelDisabled); - virCPUx86DataClear(&enabled); - virCPUx86DataClear(&disabled); - VIR_FREE(added); - VIR_FREE(removed); - virBufferFreeAndReset(&bufAdded); - virBufferFreeAndReset(&bufRemoved); - return ret; + return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 0be2cf517d..3f6d889722 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3019,45 +3019,39 @@ static int virCPUx86Translate(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) { - virCPUDefPtr translated = NULL; + g_autoptr(virCPUDef) translated = NULL; virCPUx86MapPtr map; - virCPUx86ModelPtr model = NULL; + g_autoptr(virCPUx86Model) model = NULL; size_t i; - int ret = -1; if (!(map = virCPUx86GetMap())) - goto cleanup; + return -1; if (!(model = x86ModelFromCPU(cpu, map, -1))) - goto cleanup; + return -1; if (model->vendor && virCPUx86DataAddItem(&model->data, &model->vendor->data) < 0) - goto cleanup; + return -1; if (model->signatures && x86DataAddSignature(&model->data, model->signatures[0]) < 0) - goto cleanup; + return -1; if (!(translated = virCPUDefCopyWithoutModel(cpu))) - goto cleanup; + return -1; if (x86Decode(translated, &model->data, models, NULL, false) < 0) - goto cleanup; + return -1; for (i = 0; i < cpu->nfeatures; i++) { virCPUFeatureDefPtr f = cpu->features + i; if (virCPUDefUpdateFeature(translated, f->name, f->policy) < 0) - goto cleanup; + return -1; } virCPUDefStealModel(cpu, translated, true); - ret = 0; - - cleanup: - virCPUDefFree(translated); - x86ModelFree(model); - return ret; + return 0; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 3f6d889722..a65215caed 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3059,30 +3059,29 @@ static int virCPUx86ExpandFeatures(virCPUDefPtr cpu) { virCPUx86MapPtr map; - virCPUDefPtr expanded = NULL; - virCPUx86ModelPtr model = NULL; + g_autoptr(virCPUDef) expanded = NULL; + g_autoptr(virCPUx86Model) model = NULL; bool host = cpu->type == VIR_CPU_TYPE_HOST; size_t i; - int ret = -1; if (!(map = virCPUx86GetMap())) - goto cleanup; + return -1; if (!(expanded = virCPUDefCopy(cpu))) - goto cleanup; + return -1; virCPUDefFreeFeatures(expanded); if (!(model = x86ModelFind(map, cpu->model))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown CPU model %s"), cpu->model); - goto cleanup; + return -1; } if (!(model = x86ModelCopy(model)) || x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, &model->data, map) < 0) - goto cleanup; + return -1; for (i = 0; i < cpu->nfeatures; i++) { virCPUFeatureDefPtr f = cpu->features + i; @@ -3093,17 +3092,12 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu) continue; if (virCPUDefUpdateFeature(expanded, f->name, f->policy) < 0) - goto cleanup; + return -1; } virCPUDefFreeModel(cpu); - ret = virCPUDefCopyModel(cpu, expanded, false); - - cleanup: - virCPUDefFree(expanded); - x86ModelFree(model); - return ret; + return virCPUDefCopyModel(cpu, expanded, false); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a65215caed..16e73b5b98 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3113,7 +3113,7 @@ x86FeatureFilterMigratable(const char *name, static virCPUDefPtr virCPUx86CopyMigratable(virCPUDefPtr cpu) { - virCPUDefPtr copy; + g_autoptr(virCPUDef) copy = NULL; virCPUx86MapPtr map; if (!(map = virCPUx86GetMap())) @@ -3124,13 +3124,9 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu) if (virCPUDefCopyModelFilter(copy, cpu, false, x86FeatureFilterMigratable, map) < 0) - goto error; - - return copy; + return NULL; - error: - virCPUDefFree(copy); - return NULL; + return g_steal_pointer(©); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesCopy for easier review of the virCPUx86Signatures patch. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 16e73b5b98..4b6eaf8060 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1090,23 +1090,9 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } -static void -x86ModelFree(virCPUx86ModelPtr model) -{ - if (!model) - return; - - g_free(model->name); - g_free(model->signatures); - virCPUx86DataClear(&model->data); - g_free(model); -} -G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); - - static int -x86ModelCopySignatures(virCPUx86ModelPtr dst, - virCPUx86ModelPtr src) +virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, + virCPUx86ModelPtr src) { size_t i; @@ -1124,6 +1110,20 @@ x86ModelCopySignatures(virCPUx86ModelPtr dst, } +static void +x86ModelFree(virCPUx86ModelPtr model) +{ + if (!model) + return; + + g_free(model->name); + g_free(model->signatures); + virCPUx86DataClear(&model->data); + g_free(model); +} +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); + + static virCPUx86ModelPtr x86ModelCopy(virCPUx86ModelPtr model) { @@ -1132,7 +1132,7 @@ x86ModelCopy(virCPUx86ModelPtr model) copy = g_new0(virCPUx86Model, 1); copy->name = g_strdup(model->name); - if (x86ModelCopySignatures(copy, model) < 0) { + if (virCPUx86SignaturesCopy(copy, model) < 0) { x86ModelFree(copy); return NULL; } @@ -1360,7 +1360,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model, } model->vendor = ancestor->vendor; - if (x86ModelCopySignatures(model, ancestor) < 0) + if (virCPUx86SignaturesCopy(model, ancestor) < 0) return -1; x86DataCopy(&model->data, &ancestor->data); -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesCopy for easier review of the virCPUx86Signatures patch.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures patch. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 4b6eaf8060..ff44cae77e 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1110,6 +1110,21 @@ virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, } +static bool +virCPUx86SignaturesMatch(virCPUx86ModelPtr model, + uint32_t signature) +{ + size_t i; + + for (i = 0; i < model->nsignatures; i++) { + if (model->signatures[i] == signature) + return true; + } + + return false; +} + + static void x86ModelFree(virCPUx86ModelPtr model) { @@ -1877,21 +1892,6 @@ virCPUx86Compare(virCPUDefPtr host, } -static bool -x86ModelHasSignature(virCPUx86ModelPtr model, - uint32_t signature) -{ - size_t i; - - for (i = 0; i < model->nsignatures; i++) { - if (model->signatures[i] == signature) - return true; - } - - return false; -} - - static char * x86FormatSignatures(virCPUx86ModelPtr model) { @@ -1963,8 +1963,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * consider candidates with matching family/model. */ if (signature && - x86ModelHasSignature(current, signature) && - !x86ModelHasSignature(candidate, signature)) { + virCPUx86SignaturesMatch(current, signature) && + !virCPUx86SignaturesMatch(candidate, signature)) { VIR_DEBUG("%s differs in signature from matching %s", cpuCandidate->model, cpuCurrent->model); return 0; @@ -1980,8 +1980,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * result in longer list of features. */ if (signature && - x86ModelHasSignature(candidate, signature) && - !x86ModelHasSignature(current, signature)) { + virCPUx86SignaturesMatch(candidate, signature) && + !virCPUx86SignaturesMatch(current, signature)) { VIR_DEBUG("%s provides matching signature", cpuCandidate->model); return 1; } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures patch.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all related functions will be added and rename the function as virCPUx86SignaturesFormat for easier review of the virCPUx86Signatures patch. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ff44cae77e..182d0da97c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1125,6 +1125,23 @@ virCPUx86SignaturesMatch(virCPUx86ModelPtr model, } +static char * +virCPUx86SignaturesFormat(virCPUx86ModelPtr model) +{ + virBuffer buf = VIR_BUFFER_INITIALIZER; + size_t i; + + for (i = 0; i < model->nsignatures; i++) { + virBufferAsprintf(&buf, "%06lx,", + (unsigned long)model->signatures[i]); + } + + virBufferTrim(&buf, ","); + + return virBufferContentAndReset(&buf); +} + + static void x86ModelFree(virCPUx86ModelPtr model) { @@ -1892,23 +1909,6 @@ virCPUx86Compare(virCPUDefPtr host, } -static char * -x86FormatSignatures(virCPUx86ModelPtr model) -{ - virBuffer buf = VIR_BUFFER_INITIALIZER; - size_t i; - - for (i = 0; i < model->nsignatures; i++) { - virBufferAsprintf(&buf, "%06lx,", - (unsigned long)model->signatures[i]); - } - - virBufferTrim(&buf, ","); - - return virBufferContentAndReset(&buf); -} - - /* * Checks whether a candidate model is a better fit for the CPU data than the * current model. @@ -2138,7 +2138,7 @@ x86Decode(virCPUDefPtr cpu, if (vendor) cpu->vendor = g_strdup(vendor->name); - sigs = x86FormatSignatures(model); + sigs = virCPUx86SignaturesFormat(model); VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx", model->name, NULLSTR(sigs), (unsigned long)signature); -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Later in this series the function will work on a newly introduced virCPUx86Signatures structure. Let's move it to the place were all
s/were/where/
related functions will be added and rename the function as virCPUx86SignaturesFormat for easier review of the virCPUx86Signatures patch.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The function will be used for freeing virCPUx86Signatures structure introduced later in this series. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 182d0da97c..a71b5ccacc 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1090,6 +1090,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } +static void +virCPUx86SignaturesFree(uint32_t *signatures) +{ + g_free(signatures); +} + + static int virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, virCPUx86ModelPtr src) @@ -1149,7 +1156,7 @@ x86ModelFree(virCPUx86ModelPtr model) return; g_free(model->name); - g_free(model->signatures); + virCPUx86SignaturesFree(model->signatures); virCPUx86DataClear(&model->data); g_free(model); } @@ -1414,7 +1421,7 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, return n; /* Remove inherited signatures. */ - VIR_FREE(model->signatures); + virCPUx86SignaturesFree(model->signatures); model->nsignatures = n; if (VIR_ALLOC_N(model->signatures, n) < 0) -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
The function will be used for freeing virCPUx86Signatures structure introduced later in this series.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

It can be used for separating family, model, and stepping numbers from a single 32b integer as reported by CPUID. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index a71b5ccacc..29c6e2b6be 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -717,6 +717,18 @@ x86MakeSignature(unsigned int family, } +static void +virCPUx86SignatureFromCPUID(uint32_t sig, + unsigned int *family, + unsigned int *model, + unsigned int *stepping) +{ + *family = ((sig >> 20) & 0xff) + ((sig >> 8) & 0xf); + *model = ((sig >> 12) & 0xf0) + ((sig >> 4) & 0xf); + *stepping = sig & 0xf; +} + + static void x86DataToSignatureFull(const virCPUx86Data *data, unsigned int *family, @@ -725,17 +737,14 @@ x86DataToSignatureFull(const virCPUx86Data *data, { virCPUx86DataItem leaf1 = CPUID(.eax_in = 0x1); virCPUx86DataItemPtr item; - virCPUx86CPUIDPtr cpuid; *family = *model = *stepping = 0; if (!(item = virCPUx86DataGet(data, &leaf1))) return; - cpuid = &item->data.cpuid; - *family = ((cpuid->eax >> 20) & 0xff) + ((cpuid->eax >> 8) & 0xf); - *model = ((cpuid->eax >> 12) & 0xf0) + ((cpuid->eax >> 4) & 0xf); - *stepping = cpuid->eax & 0xf; + virCPUx86SignatureFromCPUID(item->data.cpuid.eax, + family, model, stepping); } -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
It can be used for separating family, model, and stepping numbers from a single 32b integer as reported by CPUID.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The CPU models in our cpu_map define their signatures using separate family and model numbers. Let's store the signatures in the same way in our runtime representation of the cpu_map. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 149 +++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 54 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 29c6e2b6be..ed6c1b43d3 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -121,6 +121,19 @@ static virCPUx86Feature x86_kvm_features[] = KVM_FEATURE(VIR_CPU_x86_HV_STIMER_DIRECT), }; +typedef struct _virCPUx86Signature virCPUx86Signature; +struct _virCPUx86Signature { + unsigned int family; + unsigned int model; +}; + +typedef struct _virCPUx86Signatures virCPUx86Signatures; +typedef virCPUx86Signatures *virCPUx86SignaturesPtr; +struct _virCPUx86Signatures { + size_t count; + virCPUx86Signature *items; +}; + typedef struct _virCPUx86Model virCPUx86Model; typedef virCPUx86Model *virCPUx86ModelPtr; struct _virCPUx86Model { @@ -128,8 +141,7 @@ struct _virCPUx86Model { bool decodeHost; bool decodeGuest; virCPUx86VendorPtr vendor; - size_t nsignatures; - uint32_t *signatures; + virCPUx86SignaturesPtr signatures; virCPUx86Data data; }; @@ -717,6 +729,13 @@ x86MakeSignature(unsigned int family, } +static uint32_t +virCPUx86SignatureToCPUID(virCPUx86Signature *sig) +{ + return x86MakeSignature(sig->family, sig->model, 0); +} + + static void virCPUx86SignatureFromCPUID(uint32_t sig, unsigned int *family, @@ -1099,41 +1118,65 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } +static virCPUx86SignaturesPtr +virCPUx86SignaturesNew(size_t count) +{ + virCPUx86SignaturesPtr sigs; + + sigs = g_new0(virCPUx86Signatures, 1); + sigs->items = g_new0(virCPUx86Signature, count); + sigs->count = count; + + return sigs; +} + + static void -virCPUx86SignaturesFree(uint32_t *signatures) +virCPUx86SignaturesFree(virCPUx86SignaturesPtr sigs) { - g_free(signatures); + if (!sigs) + return; + + g_free(sigs->items); + g_free(sigs); } -static int -virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, - virCPUx86ModelPtr src) +static virCPUx86SignaturesPtr +virCPUx86SignaturesCopy(virCPUx86SignaturesPtr src) { + virCPUx86SignaturesPtr dst; size_t i; - if (src->nsignatures == 0) - return 0; + if (!src || src->count == 0) + return NULL; - if (VIR_ALLOC_N(dst->signatures, src->nsignatures) < 0) - return -1; + dst = virCPUx86SignaturesNew(src->count); - dst->nsignatures = src->nsignatures; - for (i = 0; i < src->nsignatures; i++) - dst->signatures[i] = src->signatures[i]; + for (i = 0; i < src->count; i++) + dst->items[i] = src->items[i]; - return 0; + return dst; } static bool -virCPUx86SignaturesMatch(virCPUx86ModelPtr model, +virCPUx86SignaturesMatch(virCPUx86SignaturesPtr sigs, uint32_t signature) { size_t i; + unsigned int family; + unsigned int model; + unsigned int stepping; - for (i = 0; i < model->nsignatures; i++) { - if (model->signatures[i] == signature) + if (!sigs) + return false; + + virCPUx86SignatureFromCPUID(signature, &family, &model, &stepping); + + for (i = 0; i < sigs->count; i++) { + if (sigs->items[i].family == family && + sigs->items[i].model == model) return true; } @@ -1142,17 +1185,21 @@ virCPUx86SignaturesMatch(virCPUx86ModelPtr model, static char * -virCPUx86SignaturesFormat(virCPUx86ModelPtr model) +virCPUx86SignaturesFormat(virCPUx86SignaturesPtr sigs) { virBuffer buf = VIR_BUFFER_INITIALIZER; size_t i; - for (i = 0; i < model->nsignatures; i++) { - virBufferAsprintf(&buf, "%06lx,", - (unsigned long)model->signatures[i]); + if (!sigs) + return virBufferContentAndReset(&buf); + + for (i = 0; i < sigs->count; i++) { + virBufferAsprintf(&buf, "(%u,%u,0), ", + sigs->items[i].family, + sigs->items[i].model); } - virBufferTrim(&buf, ","); + virBufferTrim(&buf, ", "); return virBufferContentAndReset(&buf); } @@ -1179,16 +1226,11 @@ x86ModelCopy(virCPUx86ModelPtr model) copy = g_new0(virCPUx86Model, 1); copy->name = g_strdup(model->name); - - if (virCPUx86SignaturesCopy(copy, model) < 0) { - x86ModelFree(copy); - return NULL; - } + copy->signatures = virCPUx86SignaturesCopy(model->signatures); x86DataCopy(©->data, &model->data); - copy->vendor = model->vendor; - return copy; + return g_steal_pointer(©); } @@ -1408,9 +1450,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model, } model->vendor = ancestor->vendor; - if (virCPUx86SignaturesCopy(model, ancestor) < 0) - return -1; - + model->signatures = virCPUx86SignaturesCopy(ancestor->signatures); x86DataCopy(&model->data, &ancestor->data); return 0; @@ -1432,34 +1472,29 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, /* Remove inherited signatures. */ virCPUx86SignaturesFree(model->signatures); - model->nsignatures = n; - if (VIR_ALLOC_N(model->signatures, n) < 0) - return -1; + model->signatures = virCPUx86SignaturesNew(n); for (i = 0; i < n; i++) { - unsigned int sigFamily = 0; - unsigned int sigModel = 0; + virCPUx86Signature *sig = &model->signatures->items[i]; int rc; ctxt->node = nodes[i]; - rc = virXPathUInt("string(@family)", ctxt, &sigFamily); - if (rc < 0 || sigFamily == 0) { + rc = virXPathUInt("string(@family)", ctxt, &sig->family); + if (rc < 0 || sig->family == 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature family in model %s"), model->name); return -1; } - rc = virXPathUInt("string(@model)", ctxt, &sigModel); + rc = virXPathUInt("string(@model)", ctxt, &sig->model); if (rc < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid CPU signature model in model %s"), model->name); return -1; } - - model->signatures[i] = x86MakeSignature(sigFamily, sigModel, 0); } ctxt->node = root; @@ -1866,9 +1901,12 @@ x86Compute(virCPUDefPtr host, &host_model->vendor->data) < 0) return VIR_CPU_COMPARE_ERROR; - if (host_model->signatures && - x86DataAddSignature(&guest_model->data, *host_model->signatures) < 0) - return VIR_CPU_COMPARE_ERROR; + if (host_model->signatures && host_model->signatures->count > 0) { + virCPUx86Signature *sig = &host_model->signatures->items[0]; + if (x86DataAddSignature(&guest_model->data, + virCPUx86SignatureToCPUID(sig)) < 0) + return VIR_CPU_COMPARE_ERROR; + } if (cpu->type == VIR_CPU_TYPE_GUEST && cpu->match == VIR_CPU_MATCH_EXACT) @@ -1979,8 +2017,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * consider candidates with matching family/model. */ if (signature && - virCPUx86SignaturesMatch(current, signature) && - !virCPUx86SignaturesMatch(candidate, signature)) { + virCPUx86SignaturesMatch(current->signatures, signature) && + !virCPUx86SignaturesMatch(candidate->signatures, signature)) { VIR_DEBUG("%s differs in signature from matching %s", cpuCandidate->model, cpuCurrent->model); return 0; @@ -1996,8 +2034,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, * result in longer list of features. */ if (signature && - virCPUx86SignaturesMatch(candidate, signature) && - !virCPUx86SignaturesMatch(current, signature)) { + virCPUx86SignaturesMatch(candidate->signatures, signature) && + !virCPUx86SignaturesMatch(current->signatures, signature)) { VIR_DEBUG("%s provides matching signature", cpuCandidate->model); return 1; } @@ -2154,7 +2192,7 @@ x86Decode(virCPUDefPtr cpu, if (vendor) cpu->vendor = g_strdup(vendor->name); - sigs = virCPUx86SignaturesFormat(model); + sigs = virCPUx86SignaturesFormat(model->signatures); VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx", model->name, NULLSTR(sigs), (unsigned long)signature); @@ -3050,9 +3088,12 @@ virCPUx86Translate(virCPUDefPtr cpu, virCPUx86DataAddItem(&model->data, &model->vendor->data) < 0) return -1; - if (model->signatures && - x86DataAddSignature(&model->data, model->signatures[0]) < 0) - return -1; + if (model->signatures && model->signatures->count > 0) { + virCPUx86Signature *sig = &model->signatures->items[0]; + if (x86DataAddSignature(&model->data, + virCPUx86SignatureToCPUID(sig)) < 0) + return -1; + } if (!(translated = virCPUDefCopyWithoutModel(cpu))) return -1; -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
The CPU models in our cpu_map define their signatures using separate family and model numbers. Let's store the signatures in the same way in our runtime representation of the cpu_map.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 149 +++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 54 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Thanks to glib allocation functions which abort on OOM the function cannot ever return NULL. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ed6c1b43d3..51c98efca9 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1287,9 +1287,6 @@ x86ModelFromCPU(const virCPUDef *cpu, model = g_new0(virCPUx86Model, 1); } - if (!model) - return NULL; - for (i = 0; i < cpu->nfeatures; i++) { virCPUx86FeaturePtr feature; virCPUFeaturePolicy fpol; @@ -1870,9 +1867,7 @@ x86Compute(virCPUDefPtr host, return VIR_CPU_COMPARE_INCOMPATIBLE; } - if (!(diff = x86ModelCopy(host_model))) - return VIR_CPU_COMPARE_ERROR; - + diff = x86ModelCopy(host_model); x86DataSubtract(&diff->data, &cpu_optional->data); x86DataSubtract(&diff->data, &cpu_require->data); x86DataSubtract(&diff->data, &cpu_disable->data); @@ -1893,8 +1888,7 @@ x86Compute(virCPUDefPtr host, } if (guest) { - if (!(guest_model = x86ModelCopy(host_model))) - return VIR_CPU_COMPARE_ERROR; + guest_model = x86ModelCopy(host_model); if (cpu->vendor && host_model->vendor && virCPUx86DataAddItem(&guest_model->data, @@ -3135,8 +3129,8 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu) return -1; } - if (!(model = x86ModelCopy(model)) || - x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, + model = x86ModelCopy(model); + if (x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, &model->data, map) < 0) return -1; -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Thanks to glib allocation functions which abort on OOM the function cannot ever return NULL.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

CPU models defined in the cpu_map can use signature/@stepping attribute to match a limited set of stepping numbers. The value is a bitmap for bits 0..15 each corresponding to a single stepping value. For example, stepping='4-6,9' will match 4, 5, 6, and 9. Omitting the attribute is equivalent to stepping='0-15'. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 60 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 51c98efca9..bd224a9d0d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -125,6 +125,7 @@ typedef struct _virCPUx86Signature virCPUx86Signature; struct _virCPUx86Signature { unsigned int family; unsigned int model; + virBitmapPtr stepping; }; typedef struct _virCPUx86Signatures virCPUx86Signatures; @@ -732,7 +733,17 @@ x86MakeSignature(unsigned int family, static uint32_t virCPUx86SignatureToCPUID(virCPUx86Signature *sig) { - return x86MakeSignature(sig->family, sig->model, 0); + unsigned int stepping = 0; + + if (sig->stepping) { + ssize_t fisrtBit; + + fisrtBit = virBitmapNextSetBit(sig->stepping, -1); + if (fisrtBit >= 0) + stepping = fisrtBit; + } + + return x86MakeSignature(sig->family, sig->model, stepping); } @@ -767,8 +778,8 @@ x86DataToSignatureFull(const virCPUx86Data *data, } -/* Mask out irrelevant bits (R and Step) from processor signature. */ -#define SIGNATURE_MASK 0x0fff3ff0 +/* Mask out reserved bits from processor signature. */ +#define SIGNATURE_MASK 0x0fff3fff static uint32_t x86DataToSignature(const virCPUx86Data *data) @@ -1134,9 +1145,14 @@ virCPUx86SignaturesNew(size_t count) static void virCPUx86SignaturesFree(virCPUx86SignaturesPtr sigs) { + size_t i; + if (!sigs) return; + for (i = 0; i < sigs->count; i++) + virBitmapFree(sigs->items[i].stepping); + g_free(sigs->items); g_free(sigs); } @@ -1153,8 +1169,12 @@ virCPUx86SignaturesCopy(virCPUx86SignaturesPtr src) dst = virCPUx86SignaturesNew(src->count); - for (i = 0; i < src->count; i++) - dst->items[i] = src->items[i]; + for (i = 0; i < src->count; i++) { + dst->items[i].family = src->items[i].family; + dst->items[i].model = src->items[i].model; + if (src->items[i].stepping) + dst->items[i].stepping = virBitmapNewCopy(src->items[i].stepping); + } return dst; } @@ -1176,7 +1196,9 @@ virCPUx86SignaturesMatch(virCPUx86SignaturesPtr sigs, for (i = 0; i < sigs->count; i++) { if (sigs->items[i].family == family && - sigs->items[i].model == model) + sigs->items[i].model == model && + (!sigs->items[i].stepping || + virBitmapIsBitSet(sigs->items[i].stepping, stepping))) return true; } @@ -1194,9 +1216,15 @@ virCPUx86SignaturesFormat(virCPUx86SignaturesPtr sigs) return virBufferContentAndReset(&buf); for (i = 0; i < sigs->count; i++) { - virBufferAsprintf(&buf, "(%u,%u,0), ", + g_autofree char *stepping = NULL; + + if (sigs->items[i].stepping) + stepping = virBitmapFormat(sigs->items[i].stepping); + + virBufferAsprintf(&buf, "(%u,%u,%s), ", sigs->items[i].family, - sigs->items[i].model); + sigs->items[i].model, + stepping ? stepping : "0-15"); } virBufferTrim(&buf, ", "); @@ -1473,6 +1501,7 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, for (i = 0; i < n; i++) { virCPUx86Signature *sig = &model->signatures->items[i]; + g_autofree char *stepping = NULL; int rc; ctxt->node = nodes[i]; @@ -1492,6 +1521,11 @@ x86ModelParseSignatures(virCPUx86ModelPtr model, model->name); return -1; } + + stepping = virXPathString("string(@stepping)", ctxt); + /* stepping corresponds to 4 bits in 32b signature, see above */ + if (stepping && virBitmapParse(stepping, &sig->stepping, 16) < 0) + return -1; } ctxt->node = root; @@ -2094,6 +2128,9 @@ x86Decode(virCPUDefPtr cpu, virDomainCapsCPUModelPtr hvModel = NULL; g_autofree char *sigs = NULL; uint32_t signature; + unsigned int sigFamily; + unsigned int sigModel; + unsigned int sigStepping; ssize_t i; int rc; @@ -2107,6 +2144,7 @@ x86Decode(virCPUDefPtr cpu, vendor = x86DataToVendor(&data, map); signature = x86DataToSignature(&data); + virCPUx86SignatureFromCPUID(signature, &sigFamily, &sigModel, &sigStepping); x86DataFilterTSX(&data, vendor, map); @@ -2188,8 +2226,10 @@ x86Decode(virCPUDefPtr cpu, sigs = virCPUx86SignaturesFormat(model->signatures); - VIR_DEBUG("Using CPU model %s (signatures %s) for CPU with signature %06lx", - model->name, NULLSTR(sigs), (unsigned long)signature); + VIR_DEBUG("Using CPU model %s with signatures [%s] for " + "CPU with signature (%u,%u,%u)", + model->name, NULLSTR(sigs), + sigFamily, sigModel, sigStepping); cpu->model = g_steal_pointer(&cpuModel->model); cpu->features = g_steal_pointer(&cpuModel->features); -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
CPU models defined in the cpu_map can use signature/@stepping attribute to match a limited set of stepping numbers. The value is a bitmap for bits 0..15 each corresponding to a single stepping value. For example, stepping='4-6,9' will match 4, 5, 6, and 9. Omitting the attribute is equivalent to stepping='0-15'.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 60 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 51c98efca9..bd224a9d0d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -125,6 +125,7 @@ typedef struct _virCPUx86Signature virCPUx86Signature; struct _virCPUx86Signature { unsigned int family; unsigned int model; + virBitmapPtr stepping; };
typedef struct _virCPUx86Signatures virCPUx86Signatures; @@ -732,7 +733,17 @@ x86MakeSignature(unsigned int family, static uint32_t virCPUx86SignatureToCPUID(virCPUx86Signature *sig) { - return x86MakeSignature(sig->family, sig->model, 0); + unsigned int stepping = 0; + + if (sig->stepping) { + ssize_t fisrtBit;
first?
+ + fisrtBit = virBitmapNextSetBit(sig->stepping, -1); + if (fisrtBit >= 0) + stepping = fisrtBit; + } + + return x86MakeSignature(sig->family, sig->model, stepping); }
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

On Tue, Apr 07, 2020 at 17:36:18 +0200, Ján Tomko wrote:
On a Friday in 2020, Jiri Denemark wrote:
CPU models defined in the cpu_map can use signature/@stepping attribute to match a limited set of stepping numbers. The value is a bitmap for bits 0..15 each corresponding to a single stepping value. For example, stepping='4-6,9' will match 4, 5, 6, and 9. Omitting the attribute is equivalent to stepping='0-15'.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 60 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-)
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 51c98efca9..bd224a9d0d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -125,6 +125,7 @@ typedef struct _virCPUx86Signature virCPUx86Signature; struct _virCPUx86Signature { unsigned int family; unsigned int model; + virBitmapPtr stepping; };
typedef struct _virCPUx86Signatures virCPUx86Signatures; @@ -732,7 +733,17 @@ x86MakeSignature(unsigned int family, static uint32_t virCPUx86SignatureToCPUID(virCPUx86Signature *sig) { - return x86MakeSignature(sig->family, sig->model, 0); + unsigned int stepping = 0; + + if (sig->stepping) { + ssize_t fisrtBit;
first?
+ + fisrtBit = virBitmapNextSetBit(sig->stepping, -1); + if (fisrtBit >= 0) + stepping = fisrtBit; + }
As you can see I really use completion a lot :-)
+ + return x86MakeSignature(sig->family, sig->model, stepping); }
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Thanks for the review. Jirka

Cascadelake-Server with family 6, model 85, stepping 7. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 1 + ...6_64-cpuid-Xeon-Platinum-9242-disabled.xml | 7 + ...86_64-cpuid-Xeon-Platinum-9242-enabled.xml | 10 + .../x86_64-cpuid-Xeon-Platinum-9242-guest.xml | 38 + .../x86_64-cpuid-Xeon-Platinum-9242-host.xml | 39 + .../x86_64-cpuid-Xeon-Platinum-9242-json.xml | 21 + .../x86_64-cpuid-Xeon-Platinum-9242.json | 1405 +++++++++++++++++ .../x86_64-cpuid-Xeon-Platinum-9242.sig | 4 + .../x86_64-cpuid-Xeon-Platinum-9242.xml | 68 + 9 files changed, 1593 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml diff --git a/tests/cputest.c b/tests/cputest.c index 1f59f0d3a9..f9f1ca74ff 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1267,6 +1267,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-5115", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-8268", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-9242", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", JSON_NONE); DO_TEST_CPUID(VIR_ARCH_X86_64, "Ice-Lake-Server", JSON_MODELS); diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml new file mode 100644 index 0000000000..e7c59cef1e --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml @@ -0,0 +1,7 @@ +<!-- Features disabled by QEMU --> +<cpudata arch='x86'> + <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0804c1dc' edx='0xb0600000'/> + <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00000010' edx='0x00000000'/> + <cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/> + <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/> +</cpudata> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml new file mode 100644 index 0000000000..43c3a93a16 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml @@ -0,0 +1,10 @@ +<!-- Features enabled by QEMU --> +<cpudata arch='x86'> + <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xf7fa3223' edx='0x0f8bfbff'/> + <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000004' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0xd19f4fbb' ecx='0x0000080c' edx='0xac000400'/> + <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/> + <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00000000' ebx='0x01001000' ecx='0x00000000' edx='0x00000000'/> + <msr index='0x10a' edx='0x00000000' eax='0x000000ab'/> +</cpudata> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml new file mode 100644 index 0000000000..faabdde8a0 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml @@ -0,0 +1,38 @@ +<cpu mode='custom' match='exact'> + <model fallback='forbid'>Cascadelake-Server</model> + <vendor>Intel</vendor> + <feature policy='require' name='ds'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='est'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='dca'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='tsc_adjust'/> + <feature policy='require' name='cmt'/> + <feature policy='require' name='intel-pt'/> + <feature policy='require' name='pku'/> + <feature policy='require' name='ospke'/> + <feature policy='require' name='md-clear'/> + <feature policy='require' name='stibp'/> + <feature policy='require' name='arch-capabilities'/> + <feature policy='require' name='xsaves'/> + <feature policy='require' name='mbm_total'/> + <feature policy='require' name='mbm_local'/> + <feature policy='require' name='invtsc'/> + <feature policy='require' name='rdctl-no'/> + <feature policy='require' name='ibrs-all'/> + <feature policy='require' name='skip-l1dfl-vmentry'/> + <feature policy='require' name='mds-no'/> + <feature policy='require' name='tsx-ctrl'/> +</cpu> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml new file mode 100644 index 0000000000..01447f3478 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml @@ -0,0 +1,39 @@ +<cpu> + <arch>x86_64</arch> + <model>Cascadelake-Server</model> + <vendor>Intel</vendor> + <feature name='ds'/> + <feature name='acpi'/> + <feature name='ss'/> + <feature name='ht'/> + <feature name='tm'/> + <feature name='pbe'/> + <feature name='dtes64'/> + <feature name='monitor'/> + <feature name='ds_cpl'/> + <feature name='vmx'/> + <feature name='smx'/> + <feature name='est'/> + <feature name='tm2'/> + <feature name='xtpr'/> + <feature name='pdcm'/> + <feature name='dca'/> + <feature name='osxsave'/> + <feature name='tsc_adjust'/> + <feature name='cmt'/> + <feature name='intel-pt'/> + <feature name='pku'/> + <feature name='ospke'/> + <feature name='md-clear'/> + <feature name='stibp'/> + <feature name='arch-capabilities'/> + <feature name='xsaves'/> + <feature name='mbm_total'/> + <feature name='mbm_local'/> + <feature name='invtsc'/> + <feature name='rdctl-no'/> + <feature name='ibrs-all'/> + <feature name='skip-l1dfl-vmentry'/> + <feature name='mds-no'/> + <feature name='tsx-ctrl'/> +</cpu> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml new file mode 100644 index 0000000000..36e95029be --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml @@ -0,0 +1,21 @@ +<cpu mode='custom' match='exact'> + <model fallback='forbid'>Cascadelake-Server</model> + <vendor>Intel</vendor> + <feature policy='require' name='ss'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='hypervisor'/> + <feature policy='require' name='tsc_adjust'/> + <feature policy='require' name='umip'/> + <feature policy='require' name='pku'/> + <feature policy='require' name='md-clear'/> + <feature policy='require' name='stibp'/> + <feature policy='require' name='arch-capabilities'/> + <feature policy='require' name='xsaves'/> + <feature policy='require' name='ibpb'/> + <feature policy='require' name='amd-ssbd'/> + <feature policy='require' name='rdctl-no'/> + <feature policy='require' name='ibrs-all'/> + <feature policy='require' name='skip-l1dfl-vmentry'/> + <feature policy='require' name='mds-no'/> + <feature policy='require' name='tsx-ctrl'/> +</cpu> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json new file mode 100644 index 0000000000..103b094135 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json @@ -0,0 +1,1405 @@ +{ + "return": { + "model": { + "name": "base", + "props": { + "vmx-entry-load-rtit-ctl": false, + "phys-bits": 0, + "core-id": -1, + "xlevel": 2147483656, + "cmov": true, + "ia64": false, + "ssb-no": false, + "aes": true, + "vmx-apicv-xapic": true, + "mmx": true, + "rdpid": false, + "vmx-page-walk-4": true, + "vmx-page-walk-5": false, + "arat": true, + "gfni": false, + "vmx-desc-exit": true, + "ibrs-all": true, + "pause-filter": false, + "xsavec": true, + "intel-pt": false, + "vmx-cr8-store-exit": true, + "hv-frequencies": false, + "tsc-frequency": 0, + "vmx-rdseed-exit": true, + "xd": true, + "x-intel-pt-auto-level": false, + "hv-vendor-id": "", + "vmx-eptp-switching": true, + "kvm-asyncpf": true, + "kvm_asyncpf": true, + "perfctr_core": false, + "perfctr-core": false, + "mpx": true, + "pbe": false, + "decodeassists": false, + "avx512cd": true, + "vmx-exit-load-efer": true, + "vmx-exit-clear-bndcfgs": false, + "sse4_1": true, + "sse4.1": true, + "sse4-1": true, + "family": 6, + "legacy-cache": true, + "vmx-vmwrite-vmexit-fields": true, + "vmx-vnmi": true, + "vmx-true-ctls": true, + "host-phys-bits-limit": 48, + "vmx-ept-execonly": true, + "vmx-exit-save-efer": true, + "vmx-invept-all-context": true, + "vmware-cpuid-freq": true, + "wbnoinvd": false, + "avx512f": true, + "hv-stimer-direct": false, + "msr": true, + "mce": true, + "mca": true, + "hv-runtime": false, + "xcrypt": false, + "thread-id": -1, + "vmx-exit-load-pat": true, + "vmx-intr-exit": true, + "min-level": 31, + "vmx-flexpriority": true, + "xgetbv1": true, + "cid": false, + "hv-relaxed": false, + "hv-crash": false, + "ds": false, + "fxsr": true, + "avx512-bf16": false, + "vmx-cr8-load-exit": true, + "xsaveopt": true, + "vmx-apicv-vid": true, + "vmx-exit-save-pat": true, + "xtpr": false, + "tsx-ctrl": true, + "vmx-ple": false, + "hv-evmcs": false, + "avx512vl": true, + "avx512-vpopcntdq": false, + "phe": false, + "extapic": false, + "3dnowprefetch": true, + "vmx-vmfunc": true, + "vmx-activity-shutdown": false, + "avx512vbmi2": false, + "vmx-encls-exit": false, + "cr8legacy": false, + "vmx-msr-bitmap": true, + "stibp": true, + "cpuid-0xb": true, + "xcrypt-en": false, + "vmx-mwait-exit": true, + "kvm_pv_eoi": true, + "vmx-pml": true, + "apic-id": 4294967295, + "vmx-nmi-exit": true, + "vmx-invept-single-context-noglobals": true, + "rsba": false, + "pn": false, + "dca": false, + "vendor": "GenuineIntel", + "vmx-unrestricted-guest": true, + "hv-ipi": false, + "vmx-cr3-store-noexit": true, + "pku": true, + "smx": false, + "cmp_legacy": false, + "cmp-legacy": false, + "node-id": -1, + "avx512-4fmaps": false, + "vmcb_clean": false, + "vmcb-clean": false, + "3dnowext": false, + "amd-no-ssb": false, + "hle": true, + "npt": false, + "rdctl-no": true, + "vmx-invvpid": true, + "memory": "/machine/unattached/system[0]", + "clwb": true, + "lbrv": false, + "adx": true, + "ss": true, + "pni": true, + "svm_lock": false, + "svm-lock": false, + "pfthreshold": false, + "smep": true, + "smap": true, + "vmx-invpcid-exit": true, + "x2apic": true, + "avx512vbmi": false, + "avx512vnni": true, + "vmx-apicv-x2apic": true, + "kvm-pv-sched-yield": true, + "hv-stimer": false, + "vmx-invlpg-exit": true, + "x-hv-synic-kvm-only": true, + "vmx-invvpid-all-context": true, + "i64": true, + "vmx-activity-hlt": true, + "flushbyasid": false, + "f16c": true, + "vmx-exit-ack-intr": true, + "ace2-en": false, + "pat": true, + "pae": true, + "sse": true, + "die-id": -1, + "vmx-tsc-offset": true, + "phe-en": false, + "kvm_nopiodelay": true, + "kvm-nopiodelay": true, + "tm": false, + "kvmclock-stable-bit": true, + "vmx-rdtsc-exit": true, + "hypervisor": true, + "vmx-rdtscp-exit": true, + "socket-id": -1, + "mds-no": true, + "pcommit": false, + "vmx-vpid": true, + "syscall": true, + "level": 31, + "avx512dq": true, + "x-migrate-smi-count": false, + "svm": false, + "full-cpuid-auto-level": true, + "hv-reset": false, + "invtsc": false, + "vmx-monitor-exit": true, + "sse3": true, + "sse2": true, + "vmx-wbinvd-exit": true, + "ssbd": true, + "est": false, + "kvm-poll-control": true, + "kvm_poll_control": true, + "avx512ifma": false, + "tm2": false, + "kvm-pv-ipi": true, + "kvm-pv-eoi": true, + "cx8": true, + "vmx-invvpid-single-addr": true, + "waitpkg": false, + "cldemote": false, + "vmx-ept": true, + "hv-reenlightenment": false, + "kvm_mmu": false, + "kvm-mmu": false, + "sse4_2": true, + "sse4.2": true, + "sse4-2": true, + "pge": true, + "fill-mtrr-mask": true, + "avx512bitalg": false, + "nodeid_msr": false, + "vmx-entry-load-bndcfgs": false, + "pdcm": false, + "vmx-exit-clear-rtit-ctl": false, + "movbe": true, + "model": 85, + "nrip_save": false, + "nrip-save": false, + "kvm_pv_unhalt": true, + "ssse3": true, + "sse4a": false, + "vmx-pause-exit": true, + "invpcid": true, + "pdpe1gb": true, + "tsc-deadline": true, + "skip-l1dfl-vmentry": true, + "vmx-exit-load-perf-global-ctrl": false, + "fma": true, + "cx16": true, + "de": true, + "enforce": false, + "stepping": 7, + "xsave": true, + "clflush": true, + "skinit": false, + "tsc": true, + "tce": false, + "fpu": true, + "ibs": false, + "ds_cpl": false, + "ds-cpl": false, + "vmx-exit-nosave-debugctl": true, + "host-phys-bits": true, + "fma4": false, + "vmx-invept": true, + "la57": false, + "osvw": false, + "check": true, + "hv-spinlocks": 4294967295, + "vmx-eptad": true, + "pmu": false, + "pmm": false, + "apic": true, + "vmx-entry-noload-debugctl": true, + "spec-ctrl": true, + "vmx-posted-intr": true, + "vmx-apicv-register": true, + "min-xlevel2": 0, + "tsc-adjust": true, + "tsc_adjust": true, + "kvm-steal-time": true, + "kvm_steal_time": true, + "vmx-zero-len-inject": false, + "kvmclock": true, + "pschange-mc-no": true, + "l3-cache": true, + "vmx-rdrand-exit": true, + "lwp": false, + "hv-passthrough": false, + "amd-ssbd": true, + "ibpb": true, + "xop": false, + "avx": true, + "core-capability": false, + "vmx-invept-single-context": true, + "movdiri": false, + "ace2": false, + "avx512bw": true, + "acpi": false, + "hv-vapic": false, + "fsgsbase": true, + "vmx-ept-1gb": true, + "vmx-ept-2mb": true, + "ht": false, + "vmx-io-exit": true, + "nx": true, + "pclmulqdq": true, + "mmxext": false, + "vaes": false, + "popcnt": true, + "xsaves": true, + "movdir64b": false, + "tcg-cpuid": true, + "vmx-shadow-vmcs": true, + "lm": true, + "vmx-exit-save-preemption-timer": true, + "vmx-entry-load-pat": true, + "vmx-entry-load-perf-global-ctrl": false, + "vmx-io-bitmap": true, + "umip": true, + "vmx-store-lma": true, + "vmx-movdr-exit": true, + "pse": true, + "avx2": true, + "sep": true, + "pclmuldq": true, + "virt-ssbd": false, + "vmx-cr3-load-noexit": true, + "x-hv-max-vps": -1, + "nodeid-msr": false, + "md-clear": true, + "split-lock-detect": false, + "kvm": true, + "misalignsse": false, + "min-xlevel": 2147483656, + "kvm-pv-unhalt": true, + "bmi2": true, + "bmi1": true, + "realized": false, + "tsc_scale": false, + "tsc-scale": false, + "topoext": false, + "hv-vpindex": false, + "hv-no-nonarch-coresharing": "off", + "vmx-preemption-timer": true, + "ucode-rev": 0, + "xlevel2": 0, + "clflushopt": true, + "vmx-vnmi-pending": true, + "kvm-no-smi-migration": false, + "monitor": false, + "vmx-vintr-pending": true, + "avx512er": false, + "pmm-en": false, + "pcid": true, + "taa-no": false, + "vmx-secondary-ctls": true, + "arch-capabilities": true, + "vmx-xsaves": true, + "clzero": false, + "3dnow": false, + "erms": true, + "vmx-entry-ia32e-mode": true, + "x-force-features": false, + "lahf_lm": true, + "lahf-lm": true, + "vpclmulqdq": false, + "vmx-ins-outs": true, + "fxsr-opt": false, + "hv-synic": false, + "xstore": false, + "fxsr_opt": false, + "kvm-hint-dedicated": false, + "rtm": true, + "lmce": true, + "hv-time": false, + "perfctr-nb": false, + "perfctr_nb": false, + "ffxsr": false, + "hv-tlbflush": false, + "rdrand": true, + "rdseed": true, + "avx512-4vnniw": false, + "vmx": true, + "vme": true, + "dtes64": false, + "mtrr": true, + "rdtscp": true, + "xsaveerptr": false, + "pse36": true, + "kvm-pv-tlb-flush": true, + "vmx-activity-wait-sipi": false, + "tbm": false, + "wdt": false, + "vmx-rdpmc-exit": true, + "level-func7": 0, + "vmx-entry-load-efer": true, + "vmx-mtf": true, + "pause_filter": false, + "sha-ni": false, + "model-id": "Intel(R) Xeon(R) Platinum 9242 CPU @ 2.30GHz", + "abm": true, + "vmx-ept-advanced-exitinfo": false, + "avx512pf": false, + "vmx-hlt-exit": true, + "xstore-en": false + } + } + }, + "id": "model-expansion" +} + +{ + "return": [ + { + "name": "max", + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "host", + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "base", + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "static": true, + "migration-safe": true + }, + { + "name": "qemu64-v1", + "typename": "qemu64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu64", + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32-v1", + "typename": "qemu32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32", + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "phenom-v1", + "typename": "phenom-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "phenom", + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3-v1", + "typename": "pentium3-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3", + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2-v1", + "typename": "pentium2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2", + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium-v1", + "typename": "pentium-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium", + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270-v1", + "typename": "n270-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270", + "typename": "n270-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64-v1", + "typename": "kvm64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64", + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32-v1", + "typename": "kvm32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32", + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo-v1", + "typename": "coreduo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo", + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo-v1", + "typename": "core2duo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo", + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "athlon-v1", + "typename": "athlon-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "athlon", + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v2", + "typename": "Westmere-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v1", + "typename": "Westmere-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-IBRS", + "typename": "Westmere-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere", + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge-v2", + "typename": "Snowridge-v2-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge-v1", + "typename": "Snowridge-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge", + "typename": "Snowridge-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v3", + "typename": "Skylake-Server-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v2", + "typename": "Skylake-Server-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v1", + "typename": "Skylake-Server-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-noTSX-IBRS", + "typename": "Skylake-Server-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-IBRS", + "typename": "Skylake-Server-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server", + "typename": "Skylake-Server-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v3", + "typename": "Skylake-Client-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v2", + "typename": "Skylake-Client-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v1", + "typename": "Skylake-Client-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-noTSX-IBRS", + "typename": "Skylake-Client-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-IBRS", + "typename": "Skylake-Client-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client", + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v2", + "typename": "SandyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v1", + "typename": "SandyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-IBRS", + "typename": "SandyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge", + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn-v1", + "typename": "Penryn-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn", + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5-v1", + "typename": "Opteron_G5-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5", + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4-v1", + "typename": "Opteron_G4-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4", + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3-v1", + "typename": "Opteron_G3-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3", + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2-v1", + "typename": "Opteron_G2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2", + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1-v1", + "typename": "Opteron_G1-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1", + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v2", + "typename": "Nehalem-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v1", + "typename": "Nehalem-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-IBRS", + "typename": "Nehalem-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem", + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill-v1", + "typename": "KnightsMill-v1-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill", + "typename": "KnightsMill-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v2", + "typename": "IvyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v1", + "typename": "IvyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-IBRS", + "typename": "IvyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge", + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-v2", + "typename": "Icelake-Server-v2-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-v1", + "typename": "Icelake-Server-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-noTSX", + "typename": "Icelake-Server-noTSX-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server", + "typename": "Icelake-Server-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-v2", + "typename": "Icelake-Client-v2-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-v1", + "typename": "Icelake-Client-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-noTSX", + "typename": "Icelake-Client-noTSX-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client", + "typename": "Icelake-Client-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v4", + "typename": "Haswell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v3", + "typename": "Haswell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v2", + "typename": "Haswell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v1", + "typename": "Haswell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX-IBRS", + "typename": "Haswell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX", + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-IBRS", + "typename": "Haswell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell", + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v2", + "typename": "EPYC-v2-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v1", + "typename": "EPYC-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-IBPB", + "typename": "EPYC-IBPB-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC", + "typename": "EPYC-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana-v1", + "typename": "Dhyana-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana", + "typename": "Dhyana-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Denverton-v1", + "typename": "Denverton-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Denverton", + "typename": "Denverton-x86_64-cpu", + "unavailable-features": [ + "sha-ni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe-v1", + "typename": "Conroe-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe", + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v3", + "typename": "Cascadelake-Server-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v2", + "typename": "Cascadelake-Server-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v1", + "typename": "Cascadelake-Server-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-noTSX", + "typename": "Cascadelake-Server-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server", + "typename": "Cascadelake-Server-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v4", + "typename": "Broadwell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v3", + "typename": "Broadwell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v2", + "typename": "Broadwell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v1", + "typename": "Broadwell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX-IBRS", + "typename": "Broadwell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX", + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-IBRS", + "typename": "Broadwell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell", + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486-v1", + "typename": "486-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486", + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + } + ], + "id": "definitions" +} diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig new file mode 100644 index 0000000000..082a25b4ee --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig @@ -0,0 +1,4 @@ +050657 +family: 6 (0x06) +model: 85 (0x55) +stepping: 7 (0x07) diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml new file mode 100644 index 0000000000..e3bdd881b6 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml @@ -0,0 +1,68 @@ +<!-- Intel(R) Xeon(R) Platinum 9242 CPU @ 2.30GHz --> +<cpudata arch='x86'> + <cpuid eax_in='0x00000000' ecx_in='0x00' eax='0x0000001f' ebx='0x756e6547' ecx='0x6c65746e' edx='0x49656e69'/> + <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00050657' ebx='0x07800800' ecx='0x7ffefbff' edx='0xbfebfbff'/> + <cpuid eax_in='0x00000002' ecx_in='0x00' eax='0x76036301' ebx='0x00f0b5ff' ecx='0x00000000' edx='0x00c30000'/> + <cpuid eax_in='0x00000003' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x00' eax='0x7c004121' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x01' eax='0x7c004122' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x02' eax='0x7c004143' ebx='0x03c0003f' ecx='0x000003ff' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x03' eax='0x7c0fc163' ebx='0x0280003f' ecx='0x0000cfff' edx='0x00000005'/> + <cpuid eax_in='0x00000005' ecx_in='0x00' eax='0x00000040' ebx='0x00000040' ecx='0x00000003' edx='0x00002020'/> + <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000ef7' ebx='0x00000002' ecx='0x00000009' edx='0x00000000'/> + <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0xd39ffffb' ecx='0x00000818' edx='0xbc000400'/> + <cpuid eax_in='0x00000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000009' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000a' ecx_in='0x00' eax='0x07300404' ebx='0x00000000' ecx='0x00000000' edx='0x00000603'/> + <cpuid eax_in='0x0000000b' ecx_in='0x00' eax='0x00000001' ebx='0x00000002' ecx='0x00000100' edx='0x00000007'/> + <cpuid eax_in='0x0000000b' ecx_in='0x01' eax='0x00000006' ebx='0x00000030' ecx='0x00000201' edx='0x00000007'/> + <cpuid eax_in='0x0000000c' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x00' eax='0x000002ff' ebx='0x00000a88' ecx='0x00000a88' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x00000a08' ecx='0x00000100' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x02' eax='0x00000100' ebx='0x00000240' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x03' eax='0x00000040' ebx='0x000003c0' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x04' eax='0x00000040' ebx='0x00000400' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x05' eax='0x00000040' ebx='0x00000440' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x06' eax='0x00000200' ebx='0x00000480' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x07' eax='0x00000400' ebx='0x00000680' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x08' eax='0x00000080' ebx='0x00000000' ecx='0x00000001' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x09' eax='0x00000008' ebx='0x00000a80' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000e' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000f' ecx_in='0x00' eax='0x00000000' ebx='0x000000cf' ecx='0x00000000' edx='0x00000002'/> + <cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x0001a000' ecx='0x000000cf' edx='0x00000007'/> + <cpuid eax_in='0x00000010' ecx_in='0x00' eax='0x00000000' ebx='0x0000000a' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000010' ecx_in='0x01' eax='0x0000000a' ebx='0x00000600' ecx='0x00000004' edx='0x0000000f'/> + <cpuid eax_in='0x00000010' ecx_in='0x03' eax='0x00000059' ebx='0x00000000' ecx='0x00000004' edx='0x00000007'/> + <cpuid eax_in='0x00000011' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000012' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000013' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000014' ecx_in='0x00' eax='0x00000001' ebx='0x0000000f' ecx='0x00000007' edx='0x00000000'/> + <cpuid eax_in='0x00000014' ecx_in='0x01' eax='0x02490002' ebx='0x003f3fff' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000015' ecx_in='0x00' eax='0x00000002' ebx='0x000000b8' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000016' ecx_in='0x00' eax='0x000008fc' ebx='0x00000ed8' ecx='0x00000064' edx='0x00000000'/> + <cpuid eax_in='0x00000017' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000018' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000019' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000001a' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000001b' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000001c' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000001d' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000001e' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000001f' ecx_in='0x00' eax='0x00000001' ebx='0x00000002' ecx='0x00000100' edx='0x00000007'/> + <cpuid eax_in='0x0000001f' ecx_in='0x01' eax='0x00000006' ebx='0x00000030' ecx='0x00000201' edx='0x00000007'/> + <cpuid eax_in='0x0000001f' ecx_in='0x02' eax='0x00000007' ebx='0x00000060' ecx='0x00000502' edx='0x00000007'/> + <cpuid eax_in='0x0000001f' ecx_in='0x03' eax='0x00000000' ebx='0x00000000' ecx='0x00000003' edx='0x00000007'/> + <cpuid eax_in='0x20000000' ecx_in='0x00' eax='0x00000001' ebx='0x00000002' ecx='0x00000100' edx='0x00000007'/> + <cpuid eax_in='0x80000000' ecx_in='0x00' eax='0x80000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/> + <cpuid eax_in='0x80000002' ecx_in='0x00' eax='0x65746e49' ebx='0x2952286c' ecx='0x6f655820' edx='0x2952286e'/> + <cpuid eax_in='0x80000003' ecx_in='0x00' eax='0x616c5020' ebx='0x756e6974' ecx='0x3239206d' edx='0x43203234'/> + <cpuid eax_in='0x80000004' ecx_in='0x00' eax='0x40205550' ebx='0x332e3220' ecx='0x7a484730' edx='0x00000000'/> + <cpuid eax_in='0x80000005' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000006' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01006040' edx='0x00000000'/> + <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/> + <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x0000302e' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80860000' ecx_in='0x00' eax='0x000008fc' ebx='0x00000ed8' ecx='0x00000064' edx='0x00000000'/> + <cpuid eax_in='0xc0000000' ecx_in='0x00' eax='0x000008fc' ebx='0x00000ed8' ecx='0x00000064' edx='0x00000000'/> + <msr index='0x10a' edx='0x00000000' eax='0x000000ab'/> +</cpudata> -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Cascadelake-Server with family 6, model 85, stepping 7.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 1 + ...6_64-cpuid-Xeon-Platinum-9242-disabled.xml | 7 + ...86_64-cpuid-Xeon-Platinum-9242-enabled.xml | 10 + .../x86_64-cpuid-Xeon-Platinum-9242-guest.xml | 38 + .../x86_64-cpuid-Xeon-Platinum-9242-host.xml | 39 + .../x86_64-cpuid-Xeon-Platinum-9242-json.xml | 21 + .../x86_64-cpuid-Xeon-Platinum-9242.json | 1405 +++++++++++++++++ .../x86_64-cpuid-Xeon-Platinum-9242.sig | 4 + .../x86_64-cpuid-Xeon-Platinum-9242.xml | 68 + 9 files changed, 1593 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-9242.xml
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Skylake-Server with family 6, model 85, stepping 4, which is currently mis-detected as Cascadelake-Server CPU model. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 1 + .../x86_64-cpuid-Xeon-Gold-6130-disabled.xml | 7 + .../x86_64-cpuid-Xeon-Gold-6130-enabled.xml | 9 + .../x86_64-cpuid-Xeon-Gold-6130-guest.xml | 33 + .../x86_64-cpuid-Xeon-Gold-6130-host.xml | 35 + .../x86_64-cpuid-Xeon-Gold-6130-json.xml | 16 + .../x86_64-cpuid-Xeon-Gold-6130.json | 1201 +++++++++++++++++ .../x86_64-cpuid-Xeon-Gold-6130.sig | 4 + .../x86_64-cpuid-Xeon-Gold-6130.xml | 54 + 9 files changed, 1360 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml diff --git a/tests/cputest.c b/tests/cputest.c index f9f1ca74ff..869d016ffc 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1265,6 +1265,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-8890-v3", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7540", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-5115", JSON_MODELS); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6130", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-8268", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Platinum-9242", JSON_MODELS); diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml new file mode 100644 index 0000000000..e7c59cef1e --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml @@ -0,0 +1,7 @@ +<!-- Features disabled by QEMU --> +<cpudata arch='x86'> + <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0804c1dc' edx='0xb0600000'/> + <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02001000' ecx='0x00000010' edx='0x00000000'/> + <cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/> + <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/> +</cpudata> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml new file mode 100644 index 0000000000..8610577479 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml @@ -0,0 +1,9 @@ +<!-- Features enabled by QEMU --> +<cpudata arch='x86'> + <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xf7fa3223' edx='0x0f8bfbff'/> + <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000004' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0xd19f4fbb' ecx='0x0000000c' edx='0xac000400'/> + <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/> + <msr index='0x10a' edx='0x00000000' eax='0x00000008'/> +</cpudata> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml new file mode 100644 index 0000000000..cfb0eb982d --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml @@ -0,0 +1,33 @@ +<cpu mode='custom' match='exact'> + <model fallback='forbid'>Cascadelake-Server</model> + <vendor>Intel</vendor> + <feature policy='require' name='ds'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='dtes64'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='smx'/> + <feature policy='require' name='est'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='pdcm'/> + <feature policy='require' name='dca'/> + <feature policy='require' name='osxsave'/> + <feature policy='require' name='tsc_adjust'/> + <feature policy='require' name='cmt'/> + <feature policy='require' name='intel-pt'/> + <feature policy='require' name='pku'/> + <feature policy='require' name='ospke'/> + <feature policy='require' name='md-clear'/> + <feature policy='require' name='stibp'/> + <feature policy='require' name='xsaves'/> + <feature policy='require' name='mbm_total'/> + <feature policy='require' name='mbm_local'/> + <feature policy='require' name='invtsc'/> + <feature policy='disable' name='avx512vnni'/> +</cpu> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml new file mode 100644 index 0000000000..207e9e0ee4 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml @@ -0,0 +1,35 @@ +<cpu> + <arch>x86_64</arch> + <model>Skylake-Server-IBRS</model> + <vendor>Intel</vendor> + <feature name='ds'/> + <feature name='acpi'/> + <feature name='ss'/> + <feature name='ht'/> + <feature name='tm'/> + <feature name='pbe'/> + <feature name='dtes64'/> + <feature name='monitor'/> + <feature name='ds_cpl'/> + <feature name='vmx'/> + <feature name='smx'/> + <feature name='est'/> + <feature name='tm2'/> + <feature name='xtpr'/> + <feature name='pdcm'/> + <feature name='dca'/> + <feature name='osxsave'/> + <feature name='tsc_adjust'/> + <feature name='cmt'/> + <feature name='clflushopt'/> + <feature name='intel-pt'/> + <feature name='pku'/> + <feature name='ospke'/> + <feature name='md-clear'/> + <feature name='stibp'/> + <feature name='ssbd'/> + <feature name='xsaves'/> + <feature name='mbm_total'/> + <feature name='mbm_local'/> + <feature name='invtsc'/> +</cpu> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml new file mode 100644 index 0000000000..968d904557 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml @@ -0,0 +1,16 @@ +<cpu mode='custom' match='exact'> + <model fallback='forbid'>Cascadelake-Server</model> + <vendor>Intel</vendor> + <feature policy='require' name='ss'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='hypervisor'/> + <feature policy='require' name='tsc_adjust'/> + <feature policy='require' name='umip'/> + <feature policy='require' name='pku'/> + <feature policy='require' name='md-clear'/> + <feature policy='require' name='stibp'/> + <feature policy='require' name='arch-capabilities'/> + <feature policy='require' name='xsaves'/> + <feature policy='require' name='skip-l1dfl-vmentry'/> + <feature policy='disable' name='avx512vnni'/> +</cpu> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json new file mode 100644 index 0000000000..1a22387617 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json @@ -0,0 +1,1201 @@ +{ + "return": { + "model": { + "name": "base", + "props": { + "phys-bits": 0, + "core-id": -1, + "xlevel": 2147483656, + "cmov": true, + "ia64": false, + "ssb-no": false, + "aes": true, + "mmx": true, + "rdpid": false, + "arat": true, + "gfni": false, + "ibrs-all": false, + "pause-filter": false, + "xsavec": true, + "intel-pt": false, + "hv-frequencies": false, + "tsc-frequency": 0, + "xd": true, + "x-intel-pt-auto-level": false, + "hv-vendor-id": "", + "kvm-asyncpf": true, + "kvm_asyncpf": true, + "perfctr_core": false, + "perfctr-core": false, + "mpx": true, + "pbe": false, + "decodeassists": false, + "avx512cd": true, + "sse4_1": true, + "sse4.1": true, + "sse4-1": true, + "family": 6, + "legacy-cache": true, + "host-phys-bits-limit": 48, + "vmware-cpuid-freq": true, + "wbnoinvd": false, + "avx512f": true, + "hv-stimer-direct": false, + "msr": true, + "mce": true, + "mca": true, + "hv-runtime": false, + "xcrypt": false, + "thread-id": -1, + "min-level": 13, + "xgetbv1": true, + "cid": false, + "hv-relaxed": false, + "hv-crash": false, + "ds": false, + "fxsr": true, + "xsaveopt": true, + "xtpr": false, + "hv-evmcs": false, + "avx512vl": true, + "avx512-vpopcntdq": false, + "phe": false, + "extapic": false, + "3dnowprefetch": true, + "avx512vbmi2": false, + "cr8legacy": false, + "stibp": true, + "cpuid-0xb": true, + "xcrypt-en": false, + "kvm_pv_eoi": true, + "apic-id": 4294967295, + "rsba": false, + "pn": false, + "dca": false, + "vendor": "GenuineIntel", + "hv-ipi": false, + "pku": true, + "smx": false, + "cmp_legacy": false, + "cmp-legacy": false, + "node-id": -1, + "avx512-4fmaps": false, + "vmcb_clean": false, + "vmcb-clean": false, + "3dnowext": false, + "amd-no-ssb": false, + "hle": true, + "npt": false, + "rdctl-no": false, + "memory": "/machine/unattached/system[0]", + "clwb": true, + "lbrv": false, + "adx": true, + "ss": true, + "pni": true, + "svm_lock": false, + "svm-lock": false, + "pfthreshold": false, + "smep": true, + "smap": true, + "x2apic": true, + "avx512vbmi": false, + "avx512vnni": false, + "hv-stimer": false, + "x-hv-synic-kvm-only": true, + "i64": true, + "flushbyasid": false, + "f16c": true, + "ace2-en": false, + "pat": true, + "pae": true, + "sse": true, + "die-id": -1, + "phe-en": false, + "kvm_nopiodelay": true, + "kvm-nopiodelay": true, + "tm": false, + "kvmclock-stable-bit": true, + "hypervisor": true, + "socket-id": -1, + "mds-no": false, + "pcommit": false, + "syscall": true, + "level": 13, + "avx512dq": true, + "x-migrate-smi-count": false, + "svm": false, + "full-cpuid-auto-level": true, + "hv-reset": false, + "invtsc": false, + "sse3": true, + "sse2": true, + "ssbd": true, + "est": false, + "avx512ifma": false, + "tm2": false, + "kvm-pv-ipi": true, + "kvm-pv-eoi": true, + "cx8": true, + "cldemote": false, + "hv-reenlightenment": false, + "kvm_mmu": false, + "kvm-mmu": false, + "sse4_2": true, + "sse4.2": true, + "sse4-2": true, + "pge": true, + "fill-mtrr-mask": true, + "avx512bitalg": false, + "nodeid_msr": false, + "pdcm": false, + "movbe": true, + "model": 85, + "nrip_save": false, + "nrip-save": false, + "kvm_pv_unhalt": true, + "ssse3": true, + "sse4a": false, + "invpcid": true, + "pdpe1gb": true, + "tsc-deadline": true, + "skip-l1dfl-vmentry": true, + "fma": true, + "cx16": true, + "de": true, + "enforce": false, + "stepping": 4, + "xsave": true, + "clflush": true, + "skinit": false, + "tsc": true, + "tce": false, + "fpu": true, + "ibs": false, + "ds_cpl": false, + "ds-cpl": false, + "host-phys-bits": true, + "fma4": false, + "la57": false, + "osvw": false, + "check": true, + "hv-spinlocks": 4294967295, + "pmu": false, + "pmm": false, + "apic": true, + "spec-ctrl": true, + "min-xlevel2": 0, + "tsc-adjust": true, + "tsc_adjust": true, + "kvm-steal-time": true, + "kvm_steal_time": true, + "kvmclock": true, + "l3-cache": true, + "lwp": false, + "hv-passthrough": false, + "amd-ssbd": false, + "ibpb": false, + "xop": false, + "avx": true, + "core-capability": false, + "movdiri": false, + "ace2": false, + "avx512bw": true, + "acpi": false, + "hv-vapic": false, + "fsgsbase": true, + "ht": false, + "nx": true, + "pclmulqdq": true, + "mmxext": false, + "vaes": false, + "popcnt": true, + "xsaves": true, + "movdir64b": false, + "tcg-cpuid": true, + "lm": true, + "umip": true, + "pse": true, + "avx2": true, + "sep": true, + "pclmuldq": true, + "virt-ssbd": false, + "x-hv-max-vps": -1, + "nodeid-msr": false, + "md-clear": true, + "split-lock-detect": false, + "kvm": true, + "misalignsse": false, + "min-xlevel": 2147483656, + "kvm-pv-unhalt": true, + "bmi2": true, + "bmi1": true, + "realized": false, + "tsc_scale": false, + "tsc-scale": false, + "topoext": false, + "hv-vpindex": false, + "xlevel2": 0, + "clflushopt": true, + "kvm-no-smi-migration": false, + "monitor": false, + "avx512er": false, + "pmm-en": false, + "pcid": true, + "arch-capabilities": true, + "3dnow": false, + "erms": true, + "x-force-features": false, + "lahf-lm": true, + "lahf_lm": true, + "vpclmulqdq": false, + "fxsr-opt": false, + "hv-synic": false, + "xstore": false, + "fxsr_opt": false, + "kvm-hint-dedicated": false, + "rtm": true, + "lmce": true, + "hv-time": false, + "perfctr-nb": false, + "perfctr_nb": false, + "ffxsr": false, + "hv-tlbflush": false, + "rdrand": true, + "rdseed": true, + "avx512-4vnniw": false, + "vmx": true, + "vme": true, + "dtes64": false, + "mtrr": true, + "rdtscp": true, + "pse36": true, + "kvm-pv-tlb-flush": true, + "tbm": false, + "wdt": false, + "pause_filter": false, + "sha-ni": false, + "model-id": "Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz", + "abm": true, + "avx512pf": false, + "xstore-en": false + } + } + }, + "id": "model-expansion" +} + +{ + "return": [ + { + "name": "max", + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "host", + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": false + }, + { + "name": "base", + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "static": true, + "migration-safe": true + }, + { + "name": "qemu64-v1", + "typename": "qemu64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu64", + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32-v1", + "typename": "qemu32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32", + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "phenom-v1", + "typename": "phenom-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "phenom", + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3-v1", + "typename": "pentium3-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3", + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2-v1", + "typename": "pentium2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2", + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium-v1", + "typename": "pentium-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "pentium", + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270-v1", + "typename": "n270-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "n270", + "typename": "n270-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64-v1", + "typename": "kvm64-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64", + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32-v1", + "typename": "kvm32-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32", + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "cpu64-rhel6-v1", + "typename": "cpu64-rhel6-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a" + ], + "static": false, + "migration-safe": true + }, + { + "name": "cpu64-rhel6", + "typename": "cpu64-rhel6-x86_64-cpu", + "unavailable-features": [ + "sse4a" + ], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo-v1", + "typename": "coreduo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo", + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo-v1", + "typename": "core2duo-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo", + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "athlon-v1", + "typename": "athlon-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "athlon", + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v2", + "typename": "Westmere-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-v1", + "typename": "Westmere-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere-IBRS", + "typename": "Westmere-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere", + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge-v1", + "typename": "Snowridge-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Snowridge", + "typename": "Snowridge-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "gfni", + "cldemote", + "movdiri", + "movdir64b", + "core-capability", + "split-lock-detect" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v2", + "typename": "Skylake-Server-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-v1", + "typename": "Skylake-Server-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server-IBRS", + "typename": "Skylake-Server-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server", + "typename": "Skylake-Server-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v2", + "typename": "Skylake-Client-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-v1", + "typename": "Skylake-Client-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client-IBRS", + "typename": "Skylake-Client-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client", + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v2", + "typename": "SandyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-v1", + "typename": "SandyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge-IBRS", + "typename": "SandyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge", + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn-v1", + "typename": "Penryn-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn", + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5-v1", + "typename": "Opteron_G5-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5", + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4-v1", + "typename": "Opteron_G4-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4", + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3-v1", + "typename": "Opteron_G3-v1-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3", + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2-v1", + "typename": "Opteron_G2-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2", + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1-v1", + "typename": "Opteron_G1-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1", + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v2", + "typename": "Nehalem-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-v1", + "typename": "Nehalem-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem-IBRS", + "typename": "Nehalem-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem", + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill-v1", + "typename": "KnightsMill-v1-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "KnightsMill", + "typename": "KnightsMill-x86_64-cpu", + "unavailable-features": [ + "avx512pf", + "avx512er", + "avx512-vpopcntdq", + "avx512-4vnniw", + "avx512-4fmaps" + ], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v2", + "typename": "IvyBridge-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-v1", + "typename": "IvyBridge-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge-IBRS", + "typename": "IvyBridge-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge", + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server-v1", + "typename": "Icelake-Server-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Server", + "typename": "Icelake-Server-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "la57", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client-v1", + "typename": "Icelake-Client-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Icelake-Client", + "typename": "Icelake-Client-x86_64-cpu", + "unavailable-features": [ + "avx512vbmi", + "avx512vbmi2", + "gfni", + "vaes", + "vpclmulqdq", + "avx512vnni", + "avx512bitalg", + "avx512-vpopcntdq", + "wbnoinvd" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v4", + "typename": "Haswell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v3", + "typename": "Haswell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v2", + "typename": "Haswell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-v1", + "typename": "Haswell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX-IBRS", + "typename": "Haswell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX", + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-IBRS", + "typename": "Haswell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell", + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v2", + "typename": "EPYC-v2-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-v1", + "typename": "EPYC-v1-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC-IBPB", + "typename": "EPYC-IBPB-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb" + ], + "static": false, + "migration-safe": true + }, + { + "name": "EPYC", + "typename": "EPYC-x86_64-cpu", + "unavailable-features": [ + "sha-ni", + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana-v1", + "typename": "Dhyana-v1-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Dhyana", + "typename": "Dhyana-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "cr8legacy", + "sse4a", + "misalignsse", + "osvw", + "ibpb", + "npt", + "nrip-save" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe-v1", + "typename": "Conroe-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe", + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v2", + "typename": "Cascadelake-Server-v2-x86_64-cpu", + "unavailable-features": [ + "avx512vnni", + "rdctl-no", + "ibrs-all", + "mds-no" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server-v1", + "typename": "Cascadelake-Server-v1-x86_64-cpu", + "unavailable-features": [ + "avx512vnni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Cascadelake-Server", + "typename": "Cascadelake-Server-x86_64-cpu", + "unavailable-features": [ + "avx512vnni" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v4", + "typename": "Broadwell-v4-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v3", + "typename": "Broadwell-v3-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v2", + "typename": "Broadwell-v2-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-v1", + "typename": "Broadwell-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX-IBRS", + "typename": "Broadwell-noTSX-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX", + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-IBRS", + "typename": "Broadwell-IBRS-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell", + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486-v1", + "typename": "486-v1-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + }, + { + "name": "486", + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "static": false, + "migration-safe": true + } + ], + "id": "definitions" +} diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig new file mode 100644 index 0000000000..1a3f3449f0 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig @@ -0,0 +1,4 @@ +050654 +family: 6 (0x06) +model: 85 (0x55) +stepping: 4 (0x04) diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml new file mode 100644 index 0000000000..cb9233ee22 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml @@ -0,0 +1,54 @@ +<!-- Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz --> +<cpudata arch='x86'> + <cpuid eax_in='0x00000000' ecx_in='0x00' eax='0x00000016' ebx='0x756e6547' ecx='0x6c65746e' edx='0x49656e69'/> + <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00050654' ebx='0x29200800' ecx='0x7ffefbff' edx='0xbfebfbff'/> + <cpuid eax_in='0x00000002' ecx_in='0x00' eax='0x76036301' ebx='0x00f0b5ff' ecx='0x00000000' edx='0x00c30000'/> + <cpuid eax_in='0x00000003' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x00' eax='0x3c004121' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x01' eax='0x3c004122' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x02' eax='0x3c004143' ebx='0x03c0003f' ecx='0x000003ff' edx='0x00000000'/> + <cpuid eax_in='0x00000004' ecx_in='0x03' eax='0x3c07c163' ebx='0x0280003f' ecx='0x00007fff' edx='0x00000004'/> + <cpuid eax_in='0x00000005' ecx_in='0x00' eax='0x00000040' ebx='0x00000040' ecx='0x00000003' edx='0x00002020'/> + <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000077' ebx='0x00000002' ecx='0x00000009' edx='0x00000000'/> + <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0xd39ffffb' ecx='0x00000018' edx='0x9c002400'/> + <cpuid eax_in='0x00000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000009' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000a' ecx_in='0x00' eax='0x07300404' ebx='0x00000000' ecx='0x00000000' edx='0x00000603'/> + <cpuid eax_in='0x0000000b' ecx_in='0x00' eax='0x00000001' ebx='0x00000002' ecx='0x00000100' edx='0x00000029'/> + <cpuid eax_in='0x0000000b' ecx_in='0x01' eax='0x00000005' ebx='0x00000020' ecx='0x00000201' edx='0x00000029'/> + <cpuid eax_in='0x0000000c' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x00' eax='0x000002ff' ebx='0x00000a88' ecx='0x00000a88' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x00000a08' ecx='0x00000100' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x02' eax='0x00000100' ebx='0x00000240' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x03' eax='0x00000040' ebx='0x000003c0' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x04' eax='0x00000040' ebx='0x00000400' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x05' eax='0x00000040' ebx='0x00000440' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x06' eax='0x00000200' ebx='0x00000480' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x07' eax='0x00000400' ebx='0x00000680' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x08' eax='0x00000080' ebx='0x00000000' ecx='0x00000001' edx='0x00000000'/> + <cpuid eax_in='0x0000000d' ecx_in='0x09' eax='0x00000008' ebx='0x00000a80' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000e' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x0000000f' ecx_in='0x00' eax='0x00000000' ebx='0x0000007f' ecx='0x00000000' edx='0x00000002'/> + <cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00010000' ecx='0x0000007f' edx='0x00000007'/> + <cpuid eax_in='0x00000010' ecx_in='0x00' eax='0x00000000' ebx='0x0000000a' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000010' ecx_in='0x01' eax='0x0000000a' ebx='0x00000600' ecx='0x00000004' edx='0x0000000f'/> + <cpuid eax_in='0x00000010' ecx_in='0x03' eax='0x00000059' ebx='0x00000000' ecx='0x00000004' edx='0x00000007'/> + <cpuid eax_in='0x00000011' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000012' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000013' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000014' ecx_in='0x00' eax='0x00000001' ebx='0x0000000f' ecx='0x00000007' edx='0x00000000'/> + <cpuid eax_in='0x00000014' ecx_in='0x01' eax='0x02490002' ebx='0x003f3fff' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000015' ecx_in='0x00' eax='0x00000002' ebx='0x000000a8' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x00000016' ecx_in='0x00' eax='0x00000834' ebx='0x00000e74' ecx='0x00000064' edx='0x00000000'/> + <cpuid eax_in='0x80000000' ecx_in='0x00' eax='0x80000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/> + <cpuid eax_in='0x80000002' ecx_in='0x00' eax='0x65746e49' ebx='0x2952286c' ecx='0x6f655820' edx='0x2952286e'/> + <cpuid eax_in='0x80000003' ecx_in='0x00' eax='0x6c6f4720' ebx='0x31362064' ecx='0x43203033' edx='0x40205550'/> + <cpuid eax_in='0x80000004' ecx_in='0x00' eax='0x312e3220' ebx='0x7a484730' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000005' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000006' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01006040' edx='0x00000000'/> + <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/> + <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x0000302e' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80860000' ecx_in='0x00' eax='0x00000834' ebx='0x00000e74' ecx='0x00000064' edx='0x00000000'/> + <cpuid eax_in='0xc0000000' ecx_in='0x00' eax='0x00000834' ebx='0x00000e74' ecx='0x00000064' edx='0x00000000'/> +</cpudata> -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
Skylake-Server with family 6, model 85, stepping 4, which is currently mis-detected as Cascadelake-Server CPU model.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 1 + .../x86_64-cpuid-Xeon-Gold-6130-disabled.xml | 7 + .../x86_64-cpuid-Xeon-Gold-6130-enabled.xml | 9 + .../x86_64-cpuid-Xeon-Gold-6130-guest.xml | 33 + .../x86_64-cpuid-Xeon-Gold-6130-host.xml | 35 + .../x86_64-cpuid-Xeon-Gold-6130-json.xml | 16 + .../x86_64-cpuid-Xeon-Gold-6130.json | 1201 +++++++++++++++++ .../x86_64-cpuid-Xeon-Gold-6130.sig | 4 + .../x86_64-cpuid-Xeon-Gold-6130.xml | 54 + 9 files changed, 1360 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.sig create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130.xml
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The signatures of these two CPU model differ only in stepping as both report family 6 and model 85. Skylake-Server uses stepping 4 or less and Cascadelake-Server uses stepping 5..7. https://bugzilla.redhat.com/show_bug.cgi?id=1761678 Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 2 +- src/cpu_map/x86_Cascadelake-Server.xml | 2 +- src/cpu_map/x86_Skylake-Server-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server.xml | 2 +- tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml | 5 +++-- tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml | 5 +++-- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml index 459174a30d..bfd4629836 100644 --- a/src/cpu_map/x86_Cascadelake-Server-noTSX.xml +++ b/src/cpu_map/x86_Cascadelake-Server-noTSX.xml @@ -1,7 +1,7 @@ <cpus> <model name='Cascadelake-Server-noTSX'> <decode host='on' guest='off'/> - <signature family='6' model='85'/> <!-- 050654 --> + <signature family='6' model='85' stepping='5-7'/> <!-- 050654 --> <vendor name='Intel'/> <feature name='3dnowprefetch'/> <feature name='abm'/> diff --git a/src/cpu_map/x86_Cascadelake-Server.xml b/src/cpu_map/x86_Cascadelake-Server.xml index d7ec42f57e..335e9cb584 100644 --- a/src/cpu_map/x86_Cascadelake-Server.xml +++ b/src/cpu_map/x86_Cascadelake-Server.xml @@ -1,7 +1,7 @@ <cpus> <model name='Cascadelake-Server'> <decode host='on' guest='on'/> - <signature family='6' model='85'/> <!-- 050654 --> + <signature family='6' model='85' stepping='5-7'/> <!-- 050654 --> <vendor name='Intel'/> <feature name='3dnowprefetch'/> <feature name='abm'/> diff --git a/src/cpu_map/x86_Skylake-Server-IBRS.xml b/src/cpu_map/x86_Skylake-Server-IBRS.xml index bd6b6457ad..9fb3488809 100644 --- a/src/cpu_map/x86_Skylake-Server-IBRS.xml +++ b/src/cpu_map/x86_Skylake-Server-IBRS.xml @@ -1,7 +1,7 @@ <cpus> <model name='Skylake-Server-IBRS'> <decode host='on' guest='on'/> - <signature family='6' model='85'/> <!-- 050654 --> + <signature family='6' model='85' stepping='0-4'/> <!-- 050654 --> <vendor name='Intel'/> <feature name='3dnowprefetch'/> <feature name='abm'/> diff --git a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml index c2b7de40e8..c162c0acc3 100644 --- a/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml +++ b/src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml @@ -1,7 +1,7 @@ <cpus> <model name='Skylake-Server-noTSX-IBRS'> <decode host='on' guest='off'/> - <signature family='6' model='85'/> <!-- 050654 --> + <signature family='6' model='85' stepping='0-4'/> <!-- 050654 --> <vendor name='Intel'/> <feature name='3dnowprefetch'/> <feature name='abm'/> diff --git a/src/cpu_map/x86_Skylake-Server.xml b/src/cpu_map/x86_Skylake-Server.xml index f96875a85f..e022d94c84 100644 --- a/src/cpu_map/x86_Skylake-Server.xml +++ b/src/cpu_map/x86_Skylake-Server.xml @@ -1,7 +1,7 @@ <cpus> <model name='Skylake-Server'> <decode host='on' guest='on'/> - <signature family='6' model='85'/> <!-- 050654 --> + <signature family='6' model='85' stepping='0-4'/> <!-- 050654 --> <vendor name='Intel'/> <feature name='3dnowprefetch'/> <feature name='abm'/> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml index cfb0eb982d..c21cb1e600 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml @@ -1,5 +1,5 @@ <cpu mode='custom' match='exact'> - <model fallback='forbid'>Cascadelake-Server</model> + <model fallback='forbid'>Skylake-Server-IBRS</model> <vendor>Intel</vendor> <feature policy='require' name='ds'/> <feature policy='require' name='acpi'/> @@ -20,14 +20,15 @@ <feature policy='require' name='osxsave'/> <feature policy='require' name='tsc_adjust'/> <feature policy='require' name='cmt'/> + <feature policy='require' name='clflushopt'/> <feature policy='require' name='intel-pt'/> <feature policy='require' name='pku'/> <feature policy='require' name='ospke'/> <feature policy='require' name='md-clear'/> <feature policy='require' name='stibp'/> + <feature policy='require' name='ssbd'/> <feature policy='require' name='xsaves'/> <feature policy='require' name='mbm_total'/> <feature policy='require' name='mbm_local'/> <feature policy='require' name='invtsc'/> - <feature policy='disable' name='avx512vnni'/> </cpu> diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml index 968d904557..b482043ccf 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml @@ -1,16 +1,17 @@ <cpu mode='custom' match='exact'> - <model fallback='forbid'>Cascadelake-Server</model> + <model fallback='forbid'>Skylake-Server-IBRS</model> <vendor>Intel</vendor> <feature policy='require' name='ss'/> <feature policy='require' name='vmx'/> <feature policy='require' name='hypervisor'/> <feature policy='require' name='tsc_adjust'/> + <feature policy='require' name='clflushopt'/> <feature policy='require' name='umip'/> <feature policy='require' name='pku'/> <feature policy='require' name='md-clear'/> <feature policy='require' name='stibp'/> <feature policy='require' name='arch-capabilities'/> + <feature policy='require' name='ssbd'/> <feature policy='require' name='xsaves'/> <feature policy='require' name='skip-l1dfl-vmentry'/> - <feature policy='disable' name='avx512vnni'/> </cpu> -- 2.26.0

On a Friday in 2020, Jiri Denemark wrote:
The signatures of these two CPU model differ only in stepping as both report family 6 and model 85. Skylake-Server uses stepping 4 or less and Cascadelake-Server uses stepping 5..7.
https://bugzilla.redhat.com/show_bug.cgi?id=1761678
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu_map/x86_Cascadelake-Server-noTSX.xml | 2 +- src/cpu_map/x86_Cascadelake-Server.xml | 2 +- src/cpu_map/x86_Skylake-Server-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server-noTSX-IBRS.xml | 2 +- src/cpu_map/x86_Skylake-Server.xml | 2 +- tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-guest.xml | 5 +++-- tests/cputestdata/x86_64-cpuid-Xeon-Gold-6130-json.xml | 5 +++-- 7 files changed, 11 insertions(+), 9 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Jiri Denemark
-
Ján Tomko