From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH 1/3] KVM: MMU: Allow spte.w=1 for gpte.w=0 and cr0.wp=0 only in shadow mode Date: Thu, 27 May 2010 14:50:04 +0300 Message-ID: <1274961006-19413-2-git-send-email-avi@redhat.com> References: <1274961006-19413-1-git-send-email-avi@redhat.com> Cc: kvm@vger.kernel.org To: Xiao Guangrong , Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:12354 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759159Ab0E0LuL (ORCPT ); Thu, 27 May 2010 07:50:11 -0400 In-Reply-To: <1274961006-19413-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: When tdp is enabled, the guest's cr0.wp shouldn't have any effect on spte permissions. Signed-off-by: Avi Kivity --- arch/x86/kvm/mmu.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 136e160..39dd8d3 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1881,7 +1881,8 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, spte |= (u64)pfn << PAGE_SHIFT; if ((pte_access & ACC_WRITE_MASK) - || (write_fault && !is_write_protection(vcpu) && !user_fault)) { + || (!tdp_enabled && write_fault && !is_write_protection(vcpu) + && !user_fault)) { if (level > PT_PAGE_TABLE_LEVEL && has_wrprotected_page(vcpu->kvm, gfn, level)) { -- 1.7.1