aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/book3s.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2011-12-14 21:03:22 -0500
committerAvi Kivity <avi@redhat.com>2012-03-05 07:52:39 -0500
commit82ed36164c8a8ee685ea3fb3c4f741214ac070ca (patch)
tree259f2e7a839d7506d7fbb9a3be6763ad2f5e9fd2 /arch/powerpc/kvm/book3s.c
parent55514893739d28f095f19b012133eea4cb4a9390 (diff)
KVM: PPC: Book3s HV: Implement get_dirty_log using hardware changed bit
This changes the implementation of kvm_vm_ioctl_get_dirty_log() for Book3s HV guests to use the hardware C (changed) bits in the guest hashed page table. Since this makes the implementation quite different from the Book3s PR case, this moves the existing implementation from book3s.c to book3s_pr.c and creates a new implementation in book3s_hv.c. That implementation calls kvmppc_hv_get_dirty_log() to do the actual work by calling kvm_test_clear_dirty on each page. It iterates over the HPTEs, clearing the C bit if set, and returns 1 if any C bit was set (including the saved C bit in the rmap entry). Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r--arch/powerpc/kvm/book3s.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 6bf7e0582c5a..7d54f4ed6d96 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -477,45 +477,6 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
477 return 0; 477 return 0;
478} 478}
479 479
480/*
481 * Get (and clear) the dirty memory log for a memory slot.
482 */
483int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
484 struct kvm_dirty_log *log)
485{
486 struct kvm_memory_slot *memslot;
487 struct kvm_vcpu *vcpu;
488 ulong ga, ga_end;
489 int is_dirty = 0;
490 int r;
491 unsigned long n;
492
493 mutex_lock(&kvm->slots_lock);
494
495 r = kvm_get_dirty_log(kvm, log, &is_dirty);
496 if (r)
497 goto out;
498
499 /* If nothing is dirty, don't bother messing with page tables. */
500 if (is_dirty) {
501 memslot = id_to_memslot(kvm->memslots, log->slot);
502
503 ga = memslot->base_gfn << PAGE_SHIFT;
504 ga_end = ga + (memslot->npages << PAGE_SHIFT);
505
506 kvm_for_each_vcpu(n, vcpu, kvm)
507 kvmppc_mmu_pte_pflush(vcpu, ga, ga_end);
508
509 n = kvm_dirty_bitmap_bytes(memslot);
510 memset(memslot->dirty_bitmap, 0, n);
511 }
512
513 r = 0;
514out:
515 mutex_unlock(&kvm->slots_lock);
516 return r;
517}
518
519void kvmppc_decrementer_func(unsigned long data) 480void kvmppc_decrementer_func(unsigned long data)
520{ 481{
521 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; 482 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;