[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 3/3] target-i386: Reject invalid CPU feature names on
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 3/3] target-i386: Reject invalid CPU feature names on the command-line |
Date: |
Thu, 4 Sep 2014 19:08:22 +0200 |
From: Eduardo Habkost <address@hidden>
Instead of simply printing a warning, report an error when invalid CPU
options are provided on the CPU model string.
Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
target-i386/cpu.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 60d0dd5..88b64d8 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -592,7 +592,8 @@ static bool lookup_feature(uint32_t *pval, const char *s,
const char *e,
}
static void add_flagname_to_bitmaps(const char *flagname,
- FeatureWordArray words)
+ FeatureWordArray words,
+ Error **errp)
{
FeatureWord w;
for (w = 0; w < FEATURE_WORDS; w++) {
@@ -603,7 +604,7 @@ static void add_flagname_to_bitmaps(const char *flagname,
}
}
if (w == FEATURE_WORDS) {
- fprintf(stderr, "CPU feature %s not found\n", flagname);
+ error_setg(errp, "CPU feature %s not found", flagname);
}
}
@@ -1254,6 +1255,9 @@ void x86_cpu_compat_set_features(const char *cpu_model,
FeatureWord w,
}
}
+static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
+ bool migratable_only);
+
#ifdef CONFIG_KVM
static int cpu_x86_fill_model_id(char *str)
@@ -1310,9 +1314,6 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void
*data)
dc->props = host_x86_cpu_properties;
}
-static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
- bool migratable_only);
-
static void host_x86_cpu_initfn(Object *obj)
{
X86CPU *cpu = X86_CPU(obj);
@@ -1761,9 +1762,9 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char
*features,
while (featurestr) {
char *val;
if (featurestr[0] == '+') {
- add_flagname_to_bitmaps(featurestr + 1, plus_features);
+ add_flagname_to_bitmaps(featurestr + 1, plus_features, &local_err);
} else if (featurestr[0] == '-') {
- add_flagname_to_bitmaps(featurestr + 1, minus_features);
+ add_flagname_to_bitmaps(featurestr + 1, minus_features,
&local_err);
} else if ((val = strchr(featurestr, '='))) {
*val = 0; val++;
feat2prop(featurestr);
--
1.8.4.5