From patchwork Sat Oct 24 04:49:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 55699 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9O4oLhB015680 for ; Sat, 24 Oct 2009 04:50:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbZJXEuK (ORCPT ); Sat, 24 Oct 2009 00:50:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752134AbZJXEuA (ORCPT ); Sat, 24 Oct 2009 00:50:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17562 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbZJXEt7 (ORCPT ); Sat, 24 Oct 2009 00:49:59 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9O4o4rr019329 for ; Sat, 24 Oct 2009 00:50:04 -0400 Received: from blackpad.lan.raisama.net (vpn-12-7.rdu.redhat.com [10.11.12.7]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9O4o351029855; Sat, 24 Oct 2009 00:50:03 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 6DA2517FD08; Sat, 24 Oct 2009 02:50:01 -0200 (BRST) From: Eduardo Habkost To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org Subject: [PATCH 2/3] kvm: svm: reset cr0 properly on vcpu reset Date: Sat, 24 Oct 2009 02:49:59 -0200 Message-Id: <1256359800-16893-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1256359800-16893-1-git-send-email-ehabkost@redhat.com> References: <1256359800-16893-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 170b2d9..6b86a11 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -626,11 +626,12 @@ static void init_vmcb(struct vcpu_svm *svm) save->rip = 0x0000fff0; svm->vcpu.arch.regs[VCPU_REGS_RIP] = save->rip; - /* - * cr0 val on cpu init should be 0x60000010, we enable cpu - * cache by default. the orderly way is to enable cache in bios. + /* This is the guest-visible cr0 value. + * svm_set_cr0() sets PG and WP and clears NW and CD on save->cr0. */ - save->cr0 = 0x00000010 | X86_CR0_PG | X86_CR0_WP; + svm->vcpu.arch.cr0 = X86_CR0_NW | X86_CR0_CD | X86_CR0_ET; + kvm_set_cr0(&svm->vcpu, svm->vcpu.arch.cr0); + save->cr4 = X86_CR4_PAE; /* rdx = ?? */