aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/mmu.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-01-05 19:36:55 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2007-01-06 02:55:27 -0500
commit40907d5768ab8cadd4cad97bef350820ded20338 (patch)
treec3e18c9197c3ccbc8e57e42aa870f1e9d5740a94 /drivers/kvm/mmu.c
parente2dec939db126989808853d218e426daaeebc9e2 (diff)
[PATCH] KVM: MMU: Flush guest tlb when reducing permissions on a pte
If we reduce permissions on a pte, we must flush the cached copy of the pte from the guest's tlb. This is implemented at the moment by flushing the entire guest tlb, and can be improved by flushing just the relevant virtual address, if it is known. Signed-off-by: Avi Kivity <avi@qumranet.com> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r--drivers/kvm/mmu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index 7761089ef3bc..2fc252813927 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -383,6 +383,7 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn)
383 BUG_ON(!(*spte & PT_WRITABLE_MASK)); 383 BUG_ON(!(*spte & PT_WRITABLE_MASK));
384 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte); 384 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
385 rmap_remove(vcpu, spte); 385 rmap_remove(vcpu, spte);
386 kvm_arch_ops->tlb_flush(vcpu);
386 *spte &= ~(u64)PT_WRITABLE_MASK; 387 *spte &= ~(u64)PT_WRITABLE_MASK;
387 } 388 }
388} 389}
@@ -594,6 +595,7 @@ static void kvm_mmu_page_unlink_children(struct kvm_vcpu *vcpu,
594 rmap_remove(vcpu, &pt[i]); 595 rmap_remove(vcpu, &pt[i]);
595 pt[i] = 0; 596 pt[i] = 0;
596 } 597 }
598 kvm_arch_ops->tlb_flush(vcpu);
597 return; 599 return;
598 } 600 }
599 601
@@ -927,7 +929,10 @@ static inline void set_pte_common(struct kvm_vcpu *vcpu,
927 pgprintk("%s: found shadow page for %lx, marking ro\n", 929 pgprintk("%s: found shadow page for %lx, marking ro\n",
928 __FUNCTION__, gfn); 930 __FUNCTION__, gfn);
929 access_bits &= ~PT_WRITABLE_MASK; 931 access_bits &= ~PT_WRITABLE_MASK;
930 *shadow_pte &= ~PT_WRITABLE_MASK; 932 if (is_writeble_pte(*shadow_pte)) {
933 *shadow_pte &= ~PT_WRITABLE_MASK;
934 kvm_arch_ops->tlb_flush(vcpu);
935 }
931 } 936 }
932 } 937 }
933 938