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