0a122b
From d451bbe0826ead2944fcea51e70cab1a40c0c478 Mon Sep 17 00:00:00 2001
0a122b
From: Vadim Rozenfeld <vrozenfe@redhat.com>
0a122b
Date: Mon, 3 Mar 2014 12:09:23 +0100
0a122b
Subject: [PATCH 11/12] target-i386: Cleanup 'foo' feature handling
0a122b
MIME-Version: 1.0
0a122b
Content-Type: text/plain; charset=UTF-8
0a122b
Content-Transfer-Encoding: 8bit
0a122b
0a122b
RH-Author: Vadim Rozenfeld <vrozenfe@redhat.com>
0a122b
Message-id: <1393848564-10511-12-git-send-email-vrozenfe@redhat.com>
0a122b
Patchwork-id: 57967
0a122b
O-Subject: [RHEL-7.0 qemu-kvm v4 PATCH 11/12] target-i386: Cleanup 'foo' feature handling
0a122b
Bugzilla: 1057173
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
0a122b
RH-Acked-by: Juan Quintela <quintela@redhat.com>
0a122b
0a122b
From: Igor Mammedov <imammedo@redhat.com>
0a122b
0a122b
Features check, enforce, hv_relaxed and hv_vapic are treated as boolean
0a122b
set to 'on' when passed from command line, so it's not necessary to
0a122b
handle each of them separately. Collapse them to one catch-all branch
0a122b
which will treat any feature in format 'foo' as boolean set to 'on'.
0a122b
0a122b
Any unknown feature will be rejected by CPU property setter so there is no
0a122b
need to check for unknown feature in cpu_x86_parse_featurestr(), therefore
0a122b
it's replaced by above mentioned catch-all handler.
0a122b
0a122b
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
0a122b
Signed-off-by: Andreas Färber <afaerber@suse.de>
0a122b
(cherry picked from commit 258f5abe9a8786c410f98367e9e042ee16c249f2)
0a122b
---
0a122b
 target-i386/cpu.c | 13 ++-----------
0a122b
 1 file changed, 2 insertions(+), 11 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 target-i386/cpu.c |   13 ++-----------
0a122b
 1 files changed, 2 insertions(+), 11 deletions(-)
0a122b
0a122b
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
0a122b
index 9f2a04e..8421dfc 100644
0a122b
--- a/target-i386/cpu.c
0a122b
+++ b/target-i386/cpu.c
0a122b
@@ -1683,18 +1683,9 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char *features, Error **errp)
0a122b
                 error_setg(errp, "unrecognized feature %s", featurestr);
0a122b
                 goto out;
0a122b
             }
0a122b
-        } else if (!strcmp(featurestr, "check")) {
0a122b
-            object_property_parse(OBJECT(cpu), "on", featurestr, errp);
0a122b
-        } else if (!strcmp(featurestr, "enforce")) {
0a122b
-            object_property_parse(OBJECT(cpu), "on", featurestr, errp);
0a122b
-        } else if (!strcmp(featurestr, "hv_relaxed")) {
0a122b
-            object_property_parse(OBJECT(cpu), "on", "hv-relaxed", errp);
0a122b
-        } else if (!strcmp(featurestr, "hv_vapic")) {
0a122b
-            object_property_parse(OBJECT(cpu), "on", "hv-vapic", errp);
0a122b
         } else {
0a122b
-            error_setg(errp, "feature string `%s' not in format (+feature|"
0a122b
-                       "-feature|feature=xyz)", featurestr);
0a122b
-            goto out;
0a122b
+            feat2prop(featurestr);
0a122b
+            object_property_parse(OBJECT(cpu), "on", featurestr, errp);
0a122b
         }
0a122b
         if (error_is_set(errp)) {
0a122b
             goto out;
0a122b
-- 
0a122b
1.7.1
0a122b