[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 08/10] target-i386: Isolate enabled-by-default feature
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC 08/10] target-i386: Isolate enabled-by-default features to a separate array |
Date: |
Thu, 25 Sep 2014 17:18:27 -0300 |
This will make it easier to write unit tests for the feature
initialization logic.
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-i386/cpu.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 90d0a05..8d1af64 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -464,6 +464,11 @@ static uint32_t kvm_default_unset_features[FEATURE_WORDS]
= {
[FEAT_1_ECX] = CPUID_EXT_MONITOR,
};
+/* Features that are added by default to all CPU models in any accelerator: */
+FeatureWordArray default_features_all = {
+ [FEAT_1_ECX] = CPUID_EXT_HYPERVISOR,
+};
+
void x86_cpu_compat_disable_kvm_features(FeatureWord w, uint32_t features)
{
kvm_default_features[w] &= ~features;
@@ -1993,15 +1998,14 @@ static void x86_cpu_load_def(X86CPU *cpu,
X86CPUDefinition *def, Error **errp)
}
/* Special cases not set in the X86CPUDefinition structs: */
- if (kvm_enabled()) {
- FeatureWord w;
- for (w = 0; w < FEATURE_WORDS; w++) {
+ for (w = 0; w < FEATURE_WORDS; w++) {
+ if (kvm_enabled()) {
env->features[w] |= kvm_default_features[w];
env->features[w] &= ~kvm_default_unset_features[w];
}
+ env->features[w] |= default_features_all[w];
}
- env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR;
/* sysenter isn't supported in compatibility mode on AMD,
* syscall isn't supported in compatibility mode on Intel.
--
1.9.3
- [Qemu-devel] [RFC 00/10] Target-specific unit test support, add unit tests for target-i386/cpu.c code, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 01/10] tests: Add missing include to test-bitops.c, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 02/10] bitops.h: Don't include qemu-common.h, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 03/10] bitmap.h: Don't include qemu-common.h, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 04/10] tests: Move fake yield_until_fd_readable() to coroutine-stub.c, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 05/10] tests: Support target-specific unit tests, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 07/10] tests: Add unit test for X86CPU code, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 08/10] target-i386: Isolate enabled-by-default features to a separate array,
Eduardo Habkost <=
- [Qemu-devel] [RFC 06/10] tests: Make test-x86-cpuid target-specific, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 09/10] tests: test-x86-cpu: Add TCG feature bit initialization test, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 10/10] tests: test-x86-cpu: Add KVM feature bit initialization test, Eduardo Habkost, 2014/09/25
- Re: [Qemu-devel] [RFC 00/10] Target-specific unit test support, add unit tests for target-i386/cpu.c code, Paolo Bonzini, 2014/09/26