From patchwork Wed Aug 19 01:52:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 42474 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 n7J1qFHt022123 for ; Wed, 19 Aug 2009 01:52:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751423AbZHSBwK (ORCPT ); Tue, 18 Aug 2009 21:52:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751312AbZHSBwK (ORCPT ); Tue, 18 Aug 2009 21:52:10 -0400 Received: from mga11.intel.com ([192.55.52.93]:1921 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751199AbZHSBwJ (ORCPT ); Tue, 18 Aug 2009 21:52:09 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 18 Aug 2009 18:41:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,405,1246863600"; d="scan'208";a="718350411" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.88]) by fmsmga001.fm.intel.com with ESMTP; 18 Aug 2009 18:55:18 -0700 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1MdaLa-00075e-QU; Wed, 19 Aug 2009 09:52:18 +0800 From: Sheng Yang To: Avi Kivity Cc: kvm@vger.kernel.org, Sheng Yang Subject: [PATCH] KVM: Fix EPT with WP bit change during paging Date: Wed, 19 Aug 2009 09:52:18 +0800 Message-Id: <1250646738-27235-1-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.6.0.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org QNX update WP bit when paging enabled, which is not covered yet. This one fix QNX boot with EPT. Signed-off-by: Sheng Yang --- I think it's also necessary for 2.6.31? arch/x86/kvm/vmx.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2b7e7bd..1ee811c 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1642,7 +1642,6 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0, CPU_BASED_CR3_STORE_EXITING)); vcpu->arch.cr0 = cr0; vmx_set_cr4(vcpu, vcpu->arch.cr4); - *hw_cr0 &= ~X86_CR0_WP; } else if (!is_paging(vcpu)) { /* From nonpaging to paging */ vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, @@ -1651,9 +1650,10 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0, CPU_BASED_CR3_STORE_EXITING)); vcpu->arch.cr0 = cr0; vmx_set_cr4(vcpu, vcpu->arch.cr4); - if (!(vcpu->arch.cr0 & X86_CR0_WP)) - *hw_cr0 &= ~X86_CR0_WP; } + + if (!(cr0 & X86_CR0_WP)) + *hw_cr0 &= ~X86_CR0_WP; } static void ept_update_paging_mode_cr4(unsigned long *hw_cr4,