diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/mmu.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b6a9963400a7..b9bf016d7f0f 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -3540,12 +3540,17 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) | |||
3540 | 3540 | ||
3541 | pt = sp->spt; | 3541 | pt = sp->spt; |
3542 | for (i = 0; i < PT64_ENT_PER_PAGE; ++i) { | 3542 | for (i = 0; i < PT64_ENT_PER_PAGE; ++i) { |
3543 | if (sp->role.level != PT_PAGE_TABLE_LEVEL | 3543 | if (!is_shadow_present_pte(pt[i]) || |
3544 | && is_large_pte(pt[i])) { | 3544 | !is_last_spte(pt[i], sp->role.level)) |
3545 | continue; | ||
3546 | |||
3547 | if (is_large_pte(pt[i])) { | ||
3545 | drop_spte(kvm, &pt[i], | 3548 | drop_spte(kvm, &pt[i], |
3546 | shadow_trap_nonpresent_pte); | 3549 | shadow_trap_nonpresent_pte); |
3547 | --kvm->stat.lpages; | 3550 | --kvm->stat.lpages; |
3551 | continue; | ||
3548 | } | 3552 | } |
3553 | |||
3549 | /* avoid RMW */ | 3554 | /* avoid RMW */ |
3550 | if (is_writable_pte(pt[i])) | 3555 | if (is_writable_pte(pt[i])) |
3551 | update_spte(&pt[i], pt[i] & ~PT_WRITABLE_MASK); | 3556 | update_spte(&pt[i], pt[i] & ~PT_WRITABLE_MASK); |