[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/11] target-i386: Use FeatureWord loop on filter_fe
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 02/11] target-i386: Use FeatureWord loop on filter_features_for_kvm() |
Date: |
Mon, 6 May 2013 22:43:22 +0200 |
From: Eduardo Habkost <address@hidden>
Instead of open-coding the filtering code for each feature word, change
the existing code to use the feature_word_info array, that has exactly
the same CPUID eax/ecx/register values for each feature word.
Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
target-i386/cpu.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0f92469..a39b364 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1651,24 +1651,14 @@ static void filter_features_for_kvm(X86CPU *cpu)
{
CPUX86State *env = &cpu->env;
KVMState *s = kvm_state;
+ FeatureWord w;
- env->features[FEAT_1_EDX] &=
- kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
- env->features[FEAT_1_ECX] &=
- kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
- env->features[FEAT_8000_0001_EDX] &=
- kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_EDX);
- env->features[FEAT_8000_0001_ECX] &=
- kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_ECX);
- env->features[FEAT_SVM] &=
- kvm_arch_get_supported_cpuid(s, 0x8000000A, 0, R_EDX);
- env->features[FEAT_7_0_EBX] &=
- kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX);
- env->features[FEAT_KVM] &=
- kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX);
- env->features[FEAT_C000_0001_EDX] &=
- kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX);
-
+ for (w = 0; w < FEATURE_WORDS; w++) {
+ FeatureWordInfo *wi = &feature_word_info[w];
+ env->features[w] &= kvm_arch_get_supported_cpuid(s, wi->cpuid_eax,
+ wi->cpuid_ecx,
+ wi->cpuid_reg);
+ }
}
#endif
--
1.8.1.4
- [Qemu-devel] [PULL for-1.5 00/11] QOM CPUState patch queue 2013-05-06, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 01/11] target-i386: Add ECX information to FeatureWordInfo, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 02/11] target-i386: Use FeatureWord loop on filter_features_for_kvm(),
Andreas Färber <=
- [Qemu-devel] [PULL 04/11] target-i386: Introduce X86CPU::filtered_features field, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 05/11] target-i386: Add "filtered-features" property to X86CPU, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 08/11] target-i386: Emulate X86CPU subclasses for global properties, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 03/11] target-i386: Add "feature-words" property to X86CPU, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 06/11] qdev: Let qdev_prop_parse() pass through Error, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 07/11] qdev: Introduce qdev_prop_set_globals_for_type(), Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 09/11] target-i386: Change CPUID model of 486 to 8, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 10/11] target-i386: Introduce generic CPUID feature compat function, Andreas Färber, 2013/05/06
- [Qemu-devel] [PULL 11/11] target-i386: n270 can MOVBE, Andreas Färber, 2013/05/06