From patchwork Mon Dec 3 17:27:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 203401 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A44542C0084 for ; Tue, 4 Dec 2012 04:26:47 +1100 (EST) Received: from localhost ([::1]:53867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfZn3-0002PA-Gp for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2012 12:26:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfZmv-0002P3-3x for qemu-devel@nongnu.org; Mon, 03 Dec 2012 12:26:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfZmt-00044H-QG for qemu-devel@nongnu.org; Mon, 03 Dec 2012 12:26:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfZmt-00043e-IX for qemu-devel@nongnu.org; Mon, 03 Dec 2012 12:26:35 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qB3HQXpe027418 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Dec 2012 12:26:33 -0500 Received: from blackpad.lan.raisama.net (vpn1-5-179.gru2.redhat.com [10.97.5.179]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qB3HQXpn009654; Mon, 3 Dec 2012 12:26:33 -0500 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 0523D200E65; Mon, 3 Dec 2012 15:28:09 -0200 (BRST) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Mon, 3 Dec 2012 15:27:59 -0200 Message-Id: <1354555681-15343-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1354555681-15343-1-git-send-email-ehabkost@redhat.com> References: <1354555681-15343-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Igor Mammedov , Don Slutz , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 3/5] target-i386: postpone cpuid_level update to realize time 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 From: Igor Mammedov delay capping cpuid_level to 7 to realize time so property setters for cpuid_7_0_ebx_features and "level" could be used in any order/time between x86_cpu_initfn() and x86_cpu_realize(). Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 569acac..ee03652 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1380,9 +1380,6 @@ static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *features) if (kvm_check_features_against_host(x86_cpu_def) && enforce_cpuid) goto error; } - if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level < 7) { - x86_cpu_def->level = 7; - } return 0; error: @@ -2073,6 +2070,11 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error **errp) void x86_cpu_realize(Object *obj, Error **errp) { X86CPU *cpu = X86_CPU(obj); + CPUX86State *env = &cpu->env; + + if (env->cpuid_7_0_ebx_features && env->cpuid_level < 7) { + env->cpuid_level = 7; + } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu);