From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UULyq-0005aB-Lg for qemu-devel@nongnu.org; Mon, 22 Apr 2013 15:00:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UULyp-0002NB-Cf for qemu-devel@nongnu.org; Mon, 22 Apr 2013 15:00:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UULyo-0002MZ-W6 for qemu-devel@nongnu.org; Mon, 22 Apr 2013 15:00:47 -0400 From: Eduardo Habkost Date: Mon, 22 Apr 2013 16:00:18 -0300 Message-Id: <1366657220-776-8-git-send-email-ehabkost@redhat.com> In-Reply-To: <1366657220-776-1-git-send-email-ehabkost@redhat.com> References: <1366657220-776-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH qom-cpu 7/9] target-i386: Use FeatureWord loop on filter_features_for_kvm() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Cc: libvir-list@redhat.com, Igor Mammedov , Jiri Denemark Instead of open-coding the filtering code for each feature word, change the existing code to use the feature_word_info array, that have exactly the same CPUID eax/ecx/register values for each feature word. Signed-off-by: Eduardo Habkost --- 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 757749c..bdb94a7 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1638,24 +1638,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