From patchwork Wed Aug 15 16:13:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 177719 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 7A65C2C0086 for ; Thu, 16 Aug 2012 02:14:52 +1000 (EST) Received: from localhost ([::1]:57083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1gF8-0005Yf-Fe for incoming@patchwork.ozlabs.org; Wed, 15 Aug 2012 12:14:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1gEq-0005Ni-RY for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:14:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1gEo-0003wm-Tw for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:14:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1gEo-0003wT-M5 for qemu-devel@nongnu.org; Wed, 15 Aug 2012 12:14:30 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7FGEFIB010656 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 Aug 2012 12:14:15 -0400 Received: from thinkpad.com (vpn-238-39.phx2.redhat.com [10.3.238.39]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7FGDtHs029187; Wed, 15 Aug 2012 12:14:12 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 15 Aug 2012 18:13:24 +0200 Message-Id: <1345047221-26898-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1345047221-26898-1-git-send-email-imammedo@redhat.com> References: <1345047221-26898-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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, stefanha@linux.vnet.ibm.com, gleb@redhat.com, vijaymohan.pandarathil@hp.com, jan.kiszka@siemens.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, ehabkost@redhat.com Subject: [Qemu-devel] [PATCH 04/21] target-i386: filter out not TCG features if running without kvm at 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 Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- target-i386/cpu.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index b655dbc..cc6ce48 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1194,17 +1194,6 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) env->cpuid_xlevel2 = def->xlevel2; object_property_set_int(OBJECT(cpu), (int64_t)def->tsc_khz * 1000, "tsc-frequency", &error); - if (!kvm_enabled()) { - env->cpuid_features &= TCG_FEATURES; - env->cpuid_ext_features &= TCG_EXT_FEATURES; - env->cpuid_ext2_features &= (TCG_EXT2_FEATURES -#ifdef TARGET_X86_64 - | CPUID_EXT2_SYSCALL | CPUID_EXT2_LM -#endif - ); - env->cpuid_ext3_features &= TCG_EXT3_FEATURES; - env->cpuid_svm_features &= TCG_SVM_FEATURES; - } object_property_set_str(OBJECT(cpu), def->model_id, "model-id", &error); out: @@ -1768,6 +1757,19 @@ static void mce_init(X86CPU *cpu) void x86_cpu_realize(Object *obj, Error **errp) { X86CPU *cpu = X86_CPU(obj); + CPUX86State *env = &cpu->env; + + if (!kvm_enabled()) { + env->cpuid_features &= TCG_FEATURES; + env->cpuid_ext_features &= TCG_EXT_FEATURES; + env->cpuid_ext2_features &= (TCG_EXT2_FEATURES +#ifdef TARGET_X86_64 + | CPUID_EXT2_SYSCALL | CPUID_EXT2_LM +#endif + ); + env->cpuid_ext3_features &= TCG_EXT3_FEATURES; + env->cpuid_svm_features &= TCG_SVM_FEATURES; + } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu);