linux/arch/powerpc/kvm
Paul Mackerras 32fad281c0 KVM: PPC: Book3S HV: Make the guest hash table size configurable
This adds a new ioctl to enable userspace to control the size of the guest
hashed page table (HPT) and to clear it out when resetting the guest.
The KVM_PPC_ALLOCATE_HTAB ioctl is a VM ioctl and takes as its parameter
a pointer to a u32 containing the desired order of the HPT (log base 2
of the size in bytes), which is updated on successful return to the
actual order of the HPT which was allocated.

There must be no vcpus running at the time of this ioctl.  To enforce
this, we now keep a count of the number of vcpus running in
kvm->arch.vcpus_running.

If the ioctl is called when a HPT has already been allocated, we don't
reallocate the HPT but just clear it out.  We first clear the
kvm->arch.rma_setup_done flag, which has two effects: (a) since we hold
the kvm->lock mutex, it will prevent any vcpus from starting to run until
we're done, and (b) it means that the first vcpu to run after we're done
will re-establish the VRMA if necessary.

If userspace doesn't call this ioctl before running the first vcpu, the
kernel will allocate a default-sized HPT at that point.  We do it then
rather than when creating the VM, as the code did previously, so that
userspace has a chance to do the ioctl if it wants.

When allocating the HPT, we can allocate either from the kernel page
allocator, or from the preallocated pool.  If userspace is asking for
a different size from the preallocated HPTs, we first try to allocate
using the kernel page allocator.  Then we try to allocate from the
preallocated pool, and then if that fails, we try allocating decreasing
sizes from the kernel page allocator, down to the minimum size allowed
(256kB).  Note that the kernel page allocator limits allocations to
1 << CONFIG_FORCE_MAX_ZONEORDER pages, which by default corresponds to
16MB (on 64-bit powerpc, at least).

Signed-off-by: Paul Mackerras <paulus@samba.org>
[agraf: fix module compilation]
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-30 11:43:10 +02:00
..
44x_emulate.c KVM: PPC: Emulator: clean up SPR reads and writes 2012-05-06 16:19:13 +02:00
44x_tlb.c KVM: PPC: e500: Add shadow PID support 2011-07-12 13:16:39 +03:00
44x_tlb.h
44x.c KVM: PPC: booke: Move vm core init/destroy out of booke.c 2012-04-08 12:51:05 +03:00
book3s_32_mmu_host.c KVM: PPC: Use get/set for to_svcpu to help preemption 2012-03-05 14:52:30 +02:00
book3s_32_mmu.c KVM: PPC: Put segment registers in shared page 2010-10-24 10:52:11 +02:00
book3s_32_sr.S KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode 2011-09-25 19:52:29 +03:00
book3s_64_mmu_host.c powerpc/kvm: Fix VSID usage in 64-bit "PR" KVM 2012-05-16 15:02:11 +02:00
book3s_64_mmu_hv.c KVM: PPC: Book3S HV: Make the guest hash table size configurable 2012-05-30 11:43:10 +02:00
book3s_64_mmu.c KVM: PPC: Interpret SDR1 as HVA in PAPR mode 2011-09-25 19:52:21 +03:00
book3s_64_slb.S KVM: PPC: Book3S: PR: No isync in slbie path 2012-05-06 16:19:09 +02:00
book3s_64_vio_hv.c kvm/book3s: Make kernel emulated H_PUT_TCE available for "PR" KVM 2012-05-06 16:19:11 +02:00
book3s_64_vio.c kvm/book3s: Make kernel emulated H_PUT_TCE available for "PR" KVM 2012-05-06 16:19:11 +02:00
book3s_emulate.c KVM: PPC: Emulator: clean up SPR reads and writes 2012-05-06 16:19:13 +02:00
book3s_exports.c powerpc: various straight conversions from module.h --> export.h 2011-10-31 19:30:44 -04:00
book3s_hv_builtin.c KVM: PPC: Book3S HV: Make the guest hash table size configurable 2012-05-30 11:43:10 +02:00
book3s_hv_interrupts.S KVM: PPC: Work around POWER7 DABR corruption problem 2012-04-08 14:01:36 +03:00
book3s_hv_rm_mmu.c KVM: PPC: Book3S HV: Make the guest hash table size configurable 2012-05-30 11:43:10 +02:00
book3s_hv_rmhandlers.S KVM: PPC: Work around POWER7 DABR corruption problem 2012-04-08 14:01:36 +03:00
book3s_hv.c KVM: PPC: Book3S HV: Make the guest hash table size configurable 2012-05-30 11:43:10 +02:00
book3s_interrupts.S KVM: PPC: Save/Restore CR over vcpu_run 2012-04-03 16:42:34 +10:00
book3s_mmu_hpte.c KVM: PPC: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s 2011-07-12 13:16:46 +03:00
book3s_paired_singles.c powerpc/kvm: Fallout from system.h disintegration 2012-04-02 14:00:04 +10:00
book3s_pr_papr.c kvm/book3s: Make kernel emulated H_PUT_TCE available for "PR" KVM 2012-05-06 16:19:11 +02:00
book3s_pr.c kvm/powerpc: Add new ioctl to retreive server MMU infos 2012-05-06 16:19:12 +02:00
book3s_rmhandlers.S KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode 2011-09-25 19:52:29 +03:00
book3s_segment.S Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2012-05-24 16:17:30 -07:00
book3s.c powerpc/kvm: Fix magic page vs. 32-bit RTAS on ppc64 2012-04-08 14:02:39 +03:00
booke_emulate.c KVM: PPC: Emulator: clean up SPR reads and writes 2012-05-06 16:19:13 +02:00
booke_interrupts.S KVM: PPC: booke(hv): Fix save/restore of guest accessible SPRGs. 2012-05-06 16:19:09 +02:00
booke.c KVM: PPC: Ignore unhalt request from kvm_vcpu_block 2012-04-08 14:02:38 +03:00
booke.h KVM: PPC: Emulator: clean up SPR reads and writes 2012-05-06 16:19:13 +02:00
bookehv_interrupts.S KVM: PPC: bookehv: Fix r8/r13 storing in level exception handler 2012-05-06 16:19:11 +02:00
e500_emulate.c KVM: PPC: Emulator: clean up SPR reads and writes 2012-05-06 16:19:13 +02:00
e500_tlb.c KVM: Use minimum and maximum address mapped by TLB1 2012-05-06 16:19:07 +02:00
e500.c KVM: PPC: e500: refactor core-specific TLB code 2012-04-08 12:51:12 +03:00
e500.h KVM: Use minimum and maximum address mapped by TLB1 2012-05-06 16:19:07 +02:00
e500mc.c KVM: PPC: e500mc support 2012-04-08 12:54:33 +03:00
emulate.c KVM: PPC: Emulator: clean up SPR reads and writes 2012-05-06 16:19:13 +02:00
fpu.S
Kconfig KVM: PPC: make e500v2 kvm and e500mc cpu mutually exclusive 2012-04-08 12:54:59 +03:00
Makefile kvm/book3s: Make kernel emulated H_PUT_TCE available for "PR" KVM 2012-05-06 16:19:11 +02:00
powerpc.c KVM: PPC: Book3S HV: Make the guest hash table size configurable 2012-05-30 11:43:10 +02:00
timing.c KVM: PPC: fix partial application of "exit timing in ticks" 2011-07-12 13:16:28 +03:00
timing.h KVM: PPC: booke: category E.HV (GS-mode) support 2012-04-08 12:51:19 +03:00
trace.h KVM: PPC: booke: Add booke206 TLB trace 2012-03-05 14:52:40 +02:00