qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-i386: Reject invalid CPU feature names on the command-line
@ 2014-08-21 20:22 Eduardo Habkost
  2014-09-04  9:35 ` Igor Mammedov
  2014-09-04 15:52 ` Andreas Färber
  0 siblings, 2 replies; 3+ messages in thread
From: Eduardo Habkost @ 2014-08-21 20:22 UTC (permalink / raw)
  To: qemu-devel, Andreas Färber; +Cc: Igor Mammedov, Paolo Bonzini

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 <ehabkost@redhat.com>
---
 target-i386/cpu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 217500c..c27b24a 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);
     }
 }
 
@@ -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.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target-i386: Reject invalid CPU feature names on the command-line
  2014-08-21 20:22 [Qemu-devel] [PATCH] target-i386: Reject invalid CPU feature names on the command-line Eduardo Habkost
@ 2014-09-04  9:35 ` Igor Mammedov
  2014-09-04 15:52 ` Andreas Färber
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Mammedov @ 2014-09-04  9:35 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, qemu-devel, Andreas Färber

On Thu, 21 Aug 2014 17:22:56 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:

> 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 <ehabkost@redhat.com>

Reviewed-By: Igor Mammedov <imammedo@redhat.com>

> ---
>  target-i386/cpu.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 217500c..c27b24a 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);
>      }
>  }
>  
> @@ -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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target-i386: Reject invalid CPU feature names on the command-line
  2014-08-21 20:22 [Qemu-devel] [PATCH] target-i386: Reject invalid CPU feature names on the command-line Eduardo Habkost
  2014-09-04  9:35 ` Igor Mammedov
@ 2014-09-04 15:52 ` Andreas Färber
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2014-09-04 15:52 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: Igor Mammedov, Paolo Bonzini

Am 21.08.2014 22:22, schrieb Eduardo Habkost:
> 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 <ehabkost@redhat.com>

Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-04 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-21 20:22 [Qemu-devel] [PATCH] target-i386: Reject invalid CPU feature names on the command-line Eduardo Habkost
2014-09-04  9:35 ` Igor Mammedov
2014-09-04 15:52 ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).