|
|
619821 |
From 04a8a3d76b171deb5eaf8318591e5cfaea3cc843 Mon Sep 17 00:00:00 2001
|
|
|
619821 |
From: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
619821 |
Date: Thu, 23 Feb 2017 14:29:44 +0100
|
|
|
619821 |
Subject: [PATCH 14/17] target-i386: Loop-based copying and setting/unsetting
|
|
|
619821 |
of feature words
|
|
|
619821 |
MIME-Version: 1.0
|
|
|
619821 |
Content-Type: text/plain; charset=UTF-8
|
|
|
619821 |
Content-Transfer-Encoding: 8bit
|
|
|
619821 |
|
|
|
619821 |
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
619821 |
Message-id: <20170223142945.17790-14-ehabkost@redhat.com>
|
|
|
619821 |
Patchwork-id: 74045
|
|
|
619821 |
O-Subject: [RHEL-7.4 qemu-kvm PATCH v2 13/14] target-i386: Loop-based copying and setting/unsetting of feature words
|
|
|
619821 |
Bugzilla: 1382122
|
|
|
619821 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
619821 |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
619821 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
619821 |
|
|
|
619821 |
Now that we have the feature word arrays, we don't need to manually copy
|
|
|
619821 |
each array item, we can simply iterate through each feature word.
|
|
|
619821 |
|
|
|
619821 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
619821 |
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
|
619821 |
(cherry picked from commit e1c224b4eb3b8693c230bb2762a959ae1f531f76)
|
|
|
619821 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
619821 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
619821 |
---
|
|
|
619821 |
target-i386/cpu.c | 44 ++++++++++----------------------------------
|
|
|
619821 |
1 file changed, 10 insertions(+), 34 deletions(-)
|
|
|
619821 |
|
|
|
619821 |
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
|
|
|
619821 |
index d611062..010b95f 100644
|
|
|
619821 |
--- a/target-i386/cpu.c
|
|
|
619821 |
+++ b/target-i386/cpu.c
|
|
|
619821 |
@@ -1755,6 +1755,7 @@ static inline void feat2prop(char *s)
|
|
|
619821 |
static void cpu_x86_parse_featurestr(X86CPU *cpu, char *features, Error **errp)
|
|
|
619821 |
{
|
|
|
619821 |
char *featurestr; /* Single 'key=value" string being parsed */
|
|
|
619821 |
+ FeatureWord w;
|
|
|
619821 |
/* Features to be added */
|
|
|
619821 |
FeatureWordArray plus_features = { 0 };
|
|
|
619821 |
/* Features to be removed */
|
|
|
619821 |
@@ -1844,28 +1845,11 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char *features, Error **errp)
|
|
|
619821 |
}
|
|
|
619821 |
featurestr = strtok(NULL, ",");
|
|
|
619821 |
}
|
|
|
619821 |
- env->features[FEAT_1_EDX] |= plus_features[FEAT_1_EDX];
|
|
|
619821 |
- env->features[FEAT_1_ECX] |= plus_features[FEAT_1_ECX];
|
|
|
619821 |
- env->features[FEAT_8000_0001_EDX] |= plus_features[FEAT_8000_0001_EDX];
|
|
|
619821 |
- env->features[FEAT_8000_0001_ECX] |= plus_features[FEAT_8000_0001_ECX];
|
|
|
619821 |
- env->features[FEAT_C000_0001_EDX] |= plus_features[FEAT_C000_0001_EDX];
|
|
|
619821 |
- env->features[FEAT_KVM] |= plus_features[FEAT_KVM];
|
|
|
619821 |
- env->features[FEAT_SVM] |= plus_features[FEAT_SVM];
|
|
|
619821 |
- env->features[FEAT_7_0_EBX] |= plus_features[FEAT_7_0_EBX];
|
|
|
619821 |
- env->features[FEAT_7_0_ECX] |= plus_features[FEAT_7_0_ECX];
|
|
|
619821 |
- env->features[FEAT_7_0_EDX] |= plus_features[FEAT_7_0_EDX];
|
|
|
619821 |
- env->features[FEAT_XSAVE] |= plus_features[FEAT_XSAVE];
|
|
|
619821 |
- env->features[FEAT_1_EDX] &= ~minus_features[FEAT_1_EDX];
|
|
|
619821 |
- env->features[FEAT_1_ECX] &= ~minus_features[FEAT_1_ECX];
|
|
|
619821 |
- env->features[FEAT_8000_0001_EDX] &= ~minus_features[FEAT_8000_0001_EDX];
|
|
|
619821 |
- env->features[FEAT_8000_0001_ECX] &= ~minus_features[FEAT_8000_0001_ECX];
|
|
|
619821 |
- env->features[FEAT_C000_0001_EDX] &= ~minus_features[FEAT_C000_0001_EDX];
|
|
|
619821 |
- env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM];
|
|
|
619821 |
- env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM];
|
|
|
619821 |
- env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];
|
|
|
619821 |
- env->features[FEAT_7_0_ECX] &= ~minus_features[FEAT_7_0_ECX];
|
|
|
619821 |
- env->features[FEAT_7_0_EDX] &= ~minus_features[FEAT_7_0_EDX];
|
|
|
619821 |
- env->features[FEAT_XSAVE] &= ~minus_features[FEAT_XSAVE];
|
|
|
619821 |
+
|
|
|
619821 |
+ for (w = 0; w < FEATURE_WORDS; w++) {
|
|
|
619821 |
+ env->features[w] |= plus_features[w];
|
|
|
619821 |
+ env->features[w] &= ~minus_features[w];
|
|
|
619821 |
+ }
|
|
|
619821 |
|
|
|
619821 |
out:
|
|
|
619821 |
return;
|
|
|
619821 |
@@ -1974,6 +1958,7 @@ static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)
|
|
|
619821 |
{
|
|
|
619821 |
CPUX86State *env = &cpu->env;
|
|
|
619821 |
x86_def_t def1, *def = &def;;
|
|
|
619821 |
+ FeatureWord w;
|
|
|
619821 |
|
|
|
619821 |
memset(def, 0, sizeof(*def));
|
|
|
619821 |
|
|
|
619821 |
@@ -1992,21 +1977,12 @@ static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)
|
|
|
619821 |
object_property_set_int(OBJECT(cpu), def->family, "family", errp);
|
|
|
619821 |
object_property_set_int(OBJECT(cpu), def->model, "model", errp);
|
|
|
619821 |
object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp);
|
|
|
619821 |
- env->features[FEAT_1_EDX] = def->features[FEAT_1_EDX];
|
|
|
619821 |
- env->features[FEAT_1_ECX] = def->features[FEAT_1_ECX];
|
|
|
619821 |
- env->features[FEAT_8000_0001_EDX] = def->features[FEAT_8000_0001_EDX];
|
|
|
619821 |
- env->features[FEAT_8000_0001_ECX] = def->features[FEAT_8000_0001_ECX];
|
|
|
619821 |
object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp);
|
|
|
619821 |
- env->features[FEAT_KVM] = def->features[FEAT_KVM];
|
|
|
619821 |
- env->features[FEAT_SVM] = def->features[FEAT_SVM];
|
|
|
619821 |
- env->features[FEAT_C000_0001_EDX] = def->features[FEAT_C000_0001_EDX];
|
|
|
619821 |
- env->features[FEAT_7_0_EBX] = def->features[FEAT_7_0_EBX];
|
|
|
619821 |
- env->features[FEAT_7_0_ECX] = def->features[FEAT_7_0_ECX];
|
|
|
619821 |
- env->features[FEAT_7_0_EDX] = def->features[FEAT_7_0_EDX];
|
|
|
619821 |
- env->features[FEAT_XSAVE] = def->features[FEAT_XSAVE];
|
|
|
619821 |
env->cpuid_xlevel2 = def->xlevel2;
|
|
|
619821 |
-
|
|
|
619821 |
object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp);
|
|
|
619821 |
+ for (w = 0; w < FEATURE_WORDS; w++) {
|
|
|
619821 |
+ env->features[w] = def->features[w];
|
|
|
619821 |
+ }
|
|
|
619821 |
}
|
|
|
619821 |
|
|
|
619821 |
X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
|
|
|
619821 |
--
|
|
|
619821 |
1.8.3.1
|
|
|
619821 |
|