From patchwork Tue Oct 2 15:37:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 188584 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 C80152C0091 for ; Wed, 3 Oct 2012 02:56:44 +1000 (EST) Received: from localhost ([::1]:38135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ5lz-0000Ph-2L for incoming@patchwork.ozlabs.org; Tue, 02 Oct 2012 12:56:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ4YH-0000Ms-Qv for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:38:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ4YD-0000Pr-TL for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:38:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ4YD-0000Pm-Kn for qemu-devel@nongnu.org; Tue, 02 Oct 2012 11:38:25 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q92FcLgC015770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Oct 2012 11:38:21 -0400 Received: from dell-pet610-01.lab.eng.brq.redhat.com (dell-pet610-01.lab.eng.brq.redhat.com [10.34.42.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q92FbKI4021344; Tue, 2 Oct 2012 11:38:18 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Tue, 2 Oct 2012 17:37:09 +0200 Message-Id: <1349192235-31895-18-git-send-email-imammedo@redhat.com> In-Reply-To: <1349192235-31895-1-git-send-email-imammedo@redhat.com> References: <1349192235-31895-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, hpa@linux.intel.com, ehabkost@redhat.com, jan.kiszka@siemens.com, Don@cloudswitch.com, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, avi@redhat.com, pbonzini@redhat.com, akong@redhat.com, lersek@redhat.com, afaerber@suse.de, stefanha@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 17/23] 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 delay force set 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 files changed, 5 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 038b37e..0e9a2f1 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1554,9 +1554,7 @@ static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, x86_cpu_def->kvm_features &= ~minus_kvm_features; x86_cpu_def->svm_features &= ~minus_svm_features; x86_cpu_def->cpuid_7_0_ebx_features &= ~minus_7_0_ebx_features; - if (x86_cpu_def->cpuid_7_0_ebx_features && x86_cpu_def->level < 7) { - x86_cpu_def->level = 7; - } + g_free(s); return 0; @@ -2120,6 +2118,10 @@ void x86_cpu_realize(Object *obj, Error **errp) return; } + if (env->cpuid_7_0_ebx_features && env->cpuid_level < 7) { + env->cpuid_level = 7; + } + if (!kvm_enabled()) { env->cpuid_features &= TCG_FEATURES; env->cpuid_ext_features &= TCG_EXT_FEATURES;