From patchwork Mon Jan 20 16:41:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 312653 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0283E2C0078 for ; Tue, 21 Jan 2014 03:45:02 +1100 (EST) Received: from localhost ([::1]:53394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5Hy7-00084G-Ug for incoming@patchwork.ozlabs.org; Mon, 20 Jan 2014 11:44:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5Huw-0002DH-SB for qemu-devel@nongnu.org; Mon, 20 Jan 2014 11:41:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5Huq-0001YV-Gk for qemu-devel@nongnu.org; Mon, 20 Jan 2014 11:41:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39271) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5Huq-0001YK-9H for qemu-devel@nongnu.org; Mon, 20 Jan 2014 11:41:36 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0KGfZhL032365 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Jan 2014 11:41:35 -0500 Received: from localhost (ovpn-113-45.phx2.redhat.com [10.3.113.45]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0KGfYaq000837; Mon, 20 Jan 2014 11:41:34 -0500 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Mon, 20 Jan 2014 14:41:13 -0200 Message-Id: <1390236074-21533-7-git-send-email-ehabkost@redhat.com> In-Reply-To: <1390236074-21533-1-git-send-email-ehabkost@redhat.com> References: <1390236074-21533-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 6/7] target-i386: kvm_cpu_fill_host(): Fill feature words in a loop X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that the kvm_cpu_fill_host() code is simplified, we can simply set the feature word array using a simple loop. Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 8183be0..e76ed1e 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1162,22 +1162,13 @@ static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def) cpu_x86_fill_model_id(x86_cpu_def->model_id); - x86_cpu_def->features[FEAT_1_EDX] = - kvm_arch_get_supported_cpuid(s, 0x1, 0, R_EDX); - x86_cpu_def->features[FEAT_1_ECX] = - kvm_arch_get_supported_cpuid(s, 0x1, 0, R_ECX); - x86_cpu_def->features[FEAT_7_0_EBX] = - kvm_arch_get_supported_cpuid(s, 0x7, 0, R_EBX); - x86_cpu_def->features[FEAT_8000_0001_EDX] = - kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_EDX); - x86_cpu_def->features[FEAT_8000_0001_ECX] = - kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_ECX); - x86_cpu_def->features[FEAT_C000_0001_EDX] = - kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX); - x86_cpu_def->features[FEAT_SVM] = - kvm_arch_get_supported_cpuid(s, 0x8000000A, 0, R_EDX); - x86_cpu_def->features[FEAT_KVM] = - kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX); + FeatureWord w; + for (w = 0; w < FEATURE_WORDS; w++) { + FeatureWordInfo *wi = &feature_word_info[w]; + x86_cpu_def->features[w] = + kvm_arch_get_supported_cpuid(s, wi->cpuid_eax, wi->cpuid_ecx, + wi->cpuid_reg); + } #endif /* CONFIG_KVM */ }