diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2016-10-24 17:53:52 -0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2016-10-31 16:20:59 -0200 |
commit | 83a00f6095a36de2024d6cca57470c4dedfb85ee (patch) | |
tree | 648d6001bed6365c02838e3ddccd3b2f428086aa /target-i386/cpu.c | |
parent | 2df35773cb412e5735ccad21212ce5cc10eb9c09 (diff) |
target-i386: Print warning when mixing [+-]foo and foo=(on|off)
Print a warning when mixing [+-]foo and foo=(on|off) in the -cpu
argument in a way that will break in the future.
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386/cpu.c')
-rw-r--r-- | target-i386/cpu.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 83998a85c1..0f8a8fbd3b 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1973,6 +1973,11 @@ static const char *x86_cpu_feature_name(FeatureWord w, int bitnr) */ static GList *plus_features, *minus_features; +static gint compare_string(gconstpointer a, gconstpointer b) +{ + return g_strcmp0(a, b); +} + /* Parse "+feature,-feature,feature=foo" CPU feature string */ static void x86_cpu_parse_featurestr(const char *typename, char *features, @@ -1981,6 +1986,7 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, char *featurestr; /* Single 'key=value" string being parsed */ Error *local_err = NULL; static bool cpu_globals_initialized; + bool ambiguous = false; if (cpu_globals_initialized) { return; @@ -2022,6 +2028,19 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, feat2prop(featurestr); name = featurestr; + if (g_list_find_custom(plus_features, name, compare_string)) { + error_report("warning: Ambiguous CPU model string. " + "Don't mix both \"+%s\" and \"%s=%s\"", + name, name, val); + ambiguous = true; + } + if (g_list_find_custom(minus_features, name, compare_string)) { + error_report("warning: Ambiguous CPU model string. " + "Don't mix both \"-%s\" and \"%s=%s\"", + name, name, val); + ambiguous = true; + } + /* Special case: */ if (!strcmp(name, "tsc-freq")) { int64_t tsc_freq; @@ -2046,6 +2065,11 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features, qdev_prop_register_global(prop); } + if (ambiguous) { + error_report("warning: Compatibility of ambiguous CPU model " + "strings won't be kept on future QEMU versions"); + } + if (local_err) { error_propagate(errp, local_err); } |