aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-05-27 07:22:51 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 03:39:23 -0400
commit8184dd38e22fcaec664c2b98c382b85c26780e26 (patch)
treecf8c6dd4e1e2a2d04cb4d0dfee3b46b9c258937d /arch/x86/kvm/mmu.c
parent10ab25cd6bf7ee4e5a55d81f203f7dc1a855c27e (diff)
KVM: MMU: Allow spte.w=1 for gpte.w=0 and cr0.wp=0 only in shadow mode
When tdp is enabled, the guest's cr0.wp shouldn't have any effect on spte permissions. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 9f4be0114bce..69d40a6e1e68 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1882,7 +1882,8 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1882 spte |= (u64)pfn << PAGE_SHIFT; 1882 spte |= (u64)pfn << PAGE_SHIFT;
1883 1883
1884 if ((pte_access & ACC_WRITE_MASK) 1884 if ((pte_access & ACC_WRITE_MASK)
1885 || (write_fault && !is_write_protection(vcpu) && !user_fault)) { 1885 || (!tdp_enabled && write_fault && !is_write_protection(vcpu)
1886 && !user_fault)) {
1886 1887
1887 if (level > PT_PAGE_TABLE_LEVEL && 1888 if (level > PT_PAGE_TABLE_LEVEL &&
1888 has_wrprotected_page(vcpu->kvm, gfn, level)) { 1889 has_wrprotected_page(vcpu->kvm, gfn, level)) {