aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/mmu.c3
-rw-r--r--arch/x86/kvm/mmu_audit.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index a9a20528e700..ee768bb2367f 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1181,7 +1181,8 @@ void kvm_mmu_write_protect_pt_masked(struct kvm *kvm,
1181 unsigned long *rmapp; 1181 unsigned long *rmapp;
1182 1182
1183 while (mask) { 1183 while (mask) {
1184 rmapp = &slot->rmap[gfn_offset + __ffs(mask)]; 1184 rmapp = __gfn_to_rmap(slot->base_gfn + gfn_offset + __ffs(mask),
1185 PT_PAGE_TABLE_LEVEL, slot);
1185 __rmap_write_protect(kvm, rmapp, PT_PAGE_TABLE_LEVEL, false); 1186 __rmap_write_protect(kvm, rmapp, PT_PAGE_TABLE_LEVEL, false);
1186 1187
1187 /* clear the first set bit */ 1188 /* clear the first set bit */
diff --git a/arch/x86/kvm/mmu_audit.c b/arch/x86/kvm/mmu_audit.c
index 7d7d0b9e23eb..ca403f9bb0f2 100644
--- a/arch/x86/kvm/mmu_audit.c
+++ b/arch/x86/kvm/mmu_audit.c
@@ -190,7 +190,6 @@ static void check_mappings_rmap(struct kvm *kvm, struct kvm_mmu_page *sp)
190 190
191static void audit_write_protection(struct kvm *kvm, struct kvm_mmu_page *sp) 191static void audit_write_protection(struct kvm *kvm, struct kvm_mmu_page *sp)
192{ 192{
193 struct kvm_memory_slot *slot;
194 unsigned long *rmapp; 193 unsigned long *rmapp;
195 u64 *sptep; 194 u64 *sptep;
196 struct rmap_iterator iter; 195 struct rmap_iterator iter;
@@ -198,8 +197,7 @@ static void audit_write_protection(struct kvm *kvm, struct kvm_mmu_page *sp)
198 if (sp->role.direct || sp->unsync || sp->role.invalid) 197 if (sp->role.direct || sp->unsync || sp->role.invalid)
199 return; 198 return;
200 199
201 slot = gfn_to_memslot(kvm, sp->gfn); 200 rmapp = gfn_to_rmap(kvm, sp->gfn, PT_PAGE_TABLE_LEVEL);
202 rmapp = &slot->rmap[sp->gfn - slot->base_gfn];
203 201
204 for (sptep = rmap_get_first(*rmapp, &iter); sptep; 202 for (sptep = rmap_get_first(*rmapp, &iter); sptep;
205 sptep = rmap_get_next(&iter)) { 203 sptep = rmap_get_next(&iter)) {