From patchwork Tue Mar 15 21:50:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 87102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5E039B70AA for ; Wed, 16 Mar 2011 09:18:38 +1100 (EST) Received: from localhost ([127.0.0.1]:60187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzcYC-0007VO-Rg for incoming@patchwork.ozlabs.org; Tue, 15 Mar 2011 18:17:12 -0400 Received: from [140.186.70.92] (port=54917 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzcCg-0006IU-QT for qemu-devel@nongnu.org; Tue, 15 Mar 2011 17:57:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzcB7-0003QP-0h for qemu-devel@nongnu.org; Tue, 15 Mar 2011 17:54:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzcB6-0003Pq-Jz for qemu-devel@nongnu.org; Tue, 15 Mar 2011 17:53:20 -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 p2FLrJIW014685 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Mar 2011 17:53:19 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2FLrJBX031636; Tue, 15 Mar 2011 17:53:19 -0400 Received: from amt.cnet (vpn1-5-191.ams2.redhat.com [10.36.5.191]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p2FLrHJt023478; Tue, 15 Mar 2011 17:53:18 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id DDC2668A0B9; Tue, 15 Mar 2011 18:53:03 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p2FLr0qi002135; Tue, 15 Mar 2011 18:53:00 -0300 From: Marcelo Tosatti To: Anthony Liguori Date: Tue, 15 Mar 2011 18:50:39 -0300 Message-Id: In-Reply-To: References: 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: Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 25/35] x86: Properly reset PAT MSR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka Conforming to the Intel spec, set the power-on value of PAT also on reset, but save it across INIT. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- target-i386/cpu.h | 4 ++-- target-i386/cpuid.c | 1 - target-i386/helper.c | 5 +++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index d0eae75..c7047d5 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -685,8 +685,6 @@ typedef struct CPUX86State { uint64_t tsc; - uint64_t pat; - uint64_t mcg_status; /* exception/interrupt handling */ @@ -707,6 +705,8 @@ typedef struct CPUX86State { CPU_COMMON + uint64_t pat; + /* processor features (e.g. for CPUID insn) */ uint32_t cpuid_level; uint32_t cpuid_vendor1; diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 5382a28..814d13e 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -847,7 +847,6 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model) env->cpuid_version |= ((def->model & 0xf) << 4) | ((def->model >> 4) << 16); env->cpuid_version |= def->stepping; env->cpuid_features = def->features; - env->pat = 0x0007040600070406ULL; env->cpuid_ext_features = def->ext_features; env->cpuid_ext2_features = def->ext2_features; env->cpuid_ext3_features = def->ext3_features; diff --git a/target-i386/helper.c b/target-i386/helper.c index a08309f..d15fca5 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -99,6 +99,8 @@ void cpu_reset(CPUX86State *env) env->mxcsr = 0x1f80; + env->pat = 0x0007040600070406ULL; + memset(env->dr, 0, sizeof(env->dr)); env->dr[6] = DR6_FIXED_1; env->dr[7] = DR7_FIXED_1; @@ -1280,8 +1282,11 @@ CPUX86State *cpu_x86_init(const char *cpu_model) void do_cpu_init(CPUState *env) { int sipi = env->interrupt_request & CPU_INTERRUPT_SIPI; + uint64_t pat = env->pat; + cpu_reset(env); env->interrupt_request = sipi; + env->pat = pat; apic_init_reset(env->apic_state); env->halted = !cpu_is_bsp(env); }