aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>2012-07-02 04:57:59 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-07-18 15:55:04 -0400
commit048212d0bc0b1769a4bbecd7ace8c8d237577d1b (patch)
tree1cb228c5bc452ce63bb8a3a946d5f4a1f6fdf068 /arch/x86/kvm/mmu.c
parent77d11309b3a10e1ce112058ec2c9b7b979bcf311 (diff)
KVM: MMU: Add memslot parameter to hva handlers
This is needed to push trace_kvm_age_page() into kvm_age_rmapp() in the following patch. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 3b3f5ae5da6a..dfd7a9a31154 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1200,7 +1200,7 @@ static bool rmap_write_protect(struct kvm *kvm, u64 gfn)
1200} 1200}
1201 1201
1202static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, 1202static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
1203 unsigned long data) 1203 struct kvm_memory_slot *slot, unsigned long data)
1204{ 1204{
1205 u64 *sptep; 1205 u64 *sptep;
1206 struct rmap_iterator iter; 1206 struct rmap_iterator iter;
@@ -1218,7 +1218,7 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
1218} 1218}
1219 1219
1220static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, 1220static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
1221 unsigned long data) 1221 struct kvm_memory_slot *slot, unsigned long data)
1222{ 1222{
1223 u64 *sptep; 1223 u64 *sptep;
1224 struct rmap_iterator iter; 1224 struct rmap_iterator iter;
@@ -1265,6 +1265,7 @@ static int kvm_handle_hva_range(struct kvm *kvm,
1265 unsigned long data, 1265 unsigned long data,
1266 int (*handler)(struct kvm *kvm, 1266 int (*handler)(struct kvm *kvm,
1267 unsigned long *rmapp, 1267 unsigned long *rmapp,
1268 struct kvm_memory_slot *slot,
1268 unsigned long data)) 1269 unsigned long data))
1269{ 1270{
1270 int j; 1271 int j;
@@ -1299,7 +1300,7 @@ static int kvm_handle_hva_range(struct kvm *kvm,
1299 unsigned long *rmapp; 1300 unsigned long *rmapp;
1300 1301
1301 rmapp = __gfn_to_rmap(gfn, j, memslot); 1302 rmapp = __gfn_to_rmap(gfn, j, memslot);
1302 ret |= handler(kvm, rmapp, data); 1303 ret |= handler(kvm, rmapp, memslot, data);
1303 } 1304 }
1304 trace_kvm_age_page(memslot->userspace_addr + 1305 trace_kvm_age_page(memslot->userspace_addr +
1305 (gfn - memslot->base_gfn) * PAGE_SIZE, 1306 (gfn - memslot->base_gfn) * PAGE_SIZE,
@@ -1314,6 +1315,7 @@ static int kvm_handle_hva_range(struct kvm *kvm,
1314static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, 1315static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
1315 unsigned long data, 1316 unsigned long data,
1316 int (*handler)(struct kvm *kvm, unsigned long *rmapp, 1317 int (*handler)(struct kvm *kvm, unsigned long *rmapp,
1318 struct kvm_memory_slot *slot,
1317 unsigned long data)) 1319 unsigned long data))
1318{ 1320{
1319 return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler); 1321 return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler);
@@ -1335,7 +1337,7 @@ void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
1335} 1337}
1336 1338
1337static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 1339static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1338 unsigned long data) 1340 struct kvm_memory_slot *slot, unsigned long data)
1339{ 1341{
1340 u64 *sptep; 1342 u64 *sptep;
1341 struct rmap_iterator uninitialized_var(iter); 1343 struct rmap_iterator uninitialized_var(iter);
@@ -1350,7 +1352,7 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1350 * out actively used pages or breaking up actively used hugepages. 1352 * out actively used pages or breaking up actively used hugepages.
1351 */ 1353 */
1352 if (!shadow_accessed_mask) 1354 if (!shadow_accessed_mask)
1353 return kvm_unmap_rmapp(kvm, rmapp, data); 1355 return kvm_unmap_rmapp(kvm, rmapp, slot, data);
1354 1356
1355 for (sptep = rmap_get_first(*rmapp, &iter); sptep; 1357 for (sptep = rmap_get_first(*rmapp, &iter); sptep;
1356 sptep = rmap_get_next(&iter)) { 1358 sptep = rmap_get_next(&iter)) {
@@ -1367,7 +1369,7 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1367} 1369}
1368 1370
1369static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 1371static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
1370 unsigned long data) 1372 struct kvm_memory_slot *slot, unsigned long data)
1371{ 1373{
1372 u64 *sptep; 1374 u64 *sptep;
1373 struct rmap_iterator iter; 1375 struct rmap_iterator iter;
@@ -1405,7 +1407,7 @@ static void rmap_recycle(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
1405 1407
1406 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level); 1408 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level);
1407 1409
1408 kvm_unmap_rmapp(vcpu->kvm, rmapp, 0); 1410 kvm_unmap_rmapp(vcpu->kvm, rmapp, NULL, 0);
1409 kvm_flush_remote_tlbs(vcpu->kvm); 1411 kvm_flush_remote_tlbs(vcpu->kvm);
1410} 1412}
1411 1413