aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/mmu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 401eb7ce3207..9a57e1a01449 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -513,6 +513,7 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
513{ 513{
514 unsigned long *rmapp; 514 unsigned long *rmapp;
515 u64 *spte; 515 u64 *spte;
516 int write_protected = 0;
516 517
517 gfn = unalias_gfn(kvm, gfn); 518 gfn = unalias_gfn(kvm, gfn);
518 rmapp = gfn_to_rmap(kvm, gfn); 519 rmapp = gfn_to_rmap(kvm, gfn);
@@ -522,11 +523,14 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
522 BUG_ON(!spte); 523 BUG_ON(!spte);
523 BUG_ON(!(*spte & PT_PRESENT_MASK)); 524 BUG_ON(!(*spte & PT_PRESENT_MASK));
524 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte); 525 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
525 if (is_writeble_pte(*spte)) 526 if (is_writeble_pte(*spte)) {
526 set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK); 527 set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
527 kvm_flush_remote_tlbs(kvm); 528 write_protected = 1;
529 }
528 spte = rmap_next(kvm, rmapp, spte); 530 spte = rmap_next(kvm, rmapp, spte);
529 } 531 }
532 if (write_protected)
533 kvm_flush_remote_tlbs(kvm);
530} 534}
531 535
532#ifdef MMU_DEBUG 536#ifdef MMU_DEBUG