aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/powerpc.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2012-09-11 09:27:46 -0400
committerAlexander Graf <agraf@suse.de>2012-10-05 17:38:51 -0400
commita66b48c3a39fa1c4223d4f847fdc7a04ed1618de (patch)
tree2ee5d3e474001b19053b9f905ad4f4fd26c74551 /arch/powerpc/kvm/powerpc.c
parent2c9097e4c1340208ef93371abd4b3bd7e989381b (diff)
KVM: PPC: Move kvm->arch.slot_phys into memslot.arch
Now that we have an architecture-specific field in the kvm_memory_slot structure, we can use it to store the array of page physical addresses that we need for Book3S HV KVM on PPC970 processors. This reduces the size of struct kvm_arch for Book3S HV, and also reduces the size of struct kvm_arch_memory_slot for other PPC KVM variants since the fields in it are now only compiled in for Book3S HV. This necessitates making the kvm_arch_create_memslot and kvm_arch_free_memslot operations specific to each PPC KVM variant. That in turn means that we now don't allocate the rmap arrays on Book3S PR and Book E. Since we now unpin pages and free the slot_phys array in kvmppc_core_free_memslot, we no longer need to do it in kvmppc_core_destroy_vm, since the generic code takes care to free all the memslots when destroying a VM. We now need the new memslot to be passed in to kvmppc_core_prepare_memory_region, since we need to initialize its arch.slot_phys member on Book3S HV. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r--arch/powerpc/kvm/powerpc.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 0ffd7d17adc7..33122dd89da9 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -389,19 +389,12 @@ long kvm_arch_dev_ioctl(struct file *filp,
389void kvm_arch_free_memslot(struct kvm_memory_slot *free, 389void kvm_arch_free_memslot(struct kvm_memory_slot *free,
390 struct kvm_memory_slot *dont) 390 struct kvm_memory_slot *dont)
391{ 391{
392 if (!dont || free->arch.rmap != dont->arch.rmap) { 392 kvmppc_core_free_memslot(free, dont);
393 vfree(free->arch.rmap);
394 free->arch.rmap = NULL;
395 }
396} 393}
397 394
398int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 395int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
399{ 396{
400 slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap)); 397 return kvmppc_core_create_memslot(slot, npages);
401 if (!slot->arch.rmap)
402 return -ENOMEM;
403
404 return 0;
405} 398}
406 399
407int kvm_arch_prepare_memory_region(struct kvm *kvm, 400int kvm_arch_prepare_memory_region(struct kvm *kvm,
@@ -410,7 +403,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
410 struct kvm_userspace_memory_region *mem, 403 struct kvm_userspace_memory_region *mem,
411 int user_alloc) 404 int user_alloc)
412{ 405{
413 return kvmppc_core_prepare_memory_region(kvm, mem); 406 return kvmppc_core_prepare_memory_region(kvm, memslot, mem);
414} 407}
415 408
416void kvm_arch_commit_memory_region(struct kvm *kvm, 409void kvm_arch_commit_memory_region(struct kvm *kvm,