KVM: PPC: E500: Implement MMU notifiers
Subsystems (2)
PATCH 17/56 KVM: PPC: E500: Implement MMU notifiers
The e500 target has lived without mmu notifiers ever since it got introduced, but fails for the user space check on them with hugetlbfs.
So in order to get that one working, implement mmu notifiers in a reasonably dumb fashion and be happy. On embedded hardware, we almost never end up with mmu notifier calls, since most people don't overcommit.
Signed-off-by Alexander Graf <[email protected]>
--- arch/powerpc/include/asm/kvm_host.h | 3 +- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/Kconfig | 2 + arch/powerpc/kvm/booke.c | 6 +++ arch/powerpc/kvm/e500_tlb.c | 60 +++++++++++++++++++++++++++++++--- 5 files changed, 65 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/kvm_host.h +2 -1
@@ -46,7 +46,8 @@#define KVM_COALESCED_MMIO_PAGE_OFFSET 1#endif -#ifdef CONFIG_KVM_BOOK3S_64_HV +#if defined(CONFIG_KVM_BOOK3S_64_HV ) || defined(CONFIG_KVM_E500V2 ) || \ + defined(CONFIG_KVM_E500MC )#include <linux/mmu_notifier.h> #define KVM_ARCH_WANT_MMU_NOTIFIER
arch/powerpc/include/asm/kvm_ppc.h +1 -0
@@ -104,6 +104,7 @@ extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq);extern void kvmppc_core_dequeue_external (struct kvm_vcpu *vcpu,struct kvm_interrupt *irq); +extern void kvmppc_core_flush_tlb (struct kvm_vcpu *vcpu);extern int kvmppc_core_emulate_op (struct kvm_run *run,struct kvm_vcpu *vcpu,unsigned int op,int *advance);
arch/powerpc/kvm/Kconfig +2 -0
@@ -123,6 +123,7 @@ config KVM_E500V2 depends on EXPERIMENTAL && E500 && !PPC_E500MC select KVM select KVM_MMIO + select MMU_NOTIFIER ---help--- Support running unmodified E500 guest kernels in virtual machines on E500v2 host processors.
@@ -138,6 +139,7 @@ config KVM_E500MC select KVM select KVM_MMIO select KVM_BOOKE_HV + select MMU_NOTIFIER ---help--- Support running unmodified E500MC/E5500 (32-bit) guest kernels in virtual machines on E500MC/E5500 host processors.
arch/powerpc/kvm/booke.c +6 -0
@@ -459,6 +459,10 @@ static void kvmppc_check_requests(struct kvm_vcpu *vcpu)if (vcpu->requests) {if (kvm_check_request (KVM_REQ_PENDING_TIMER , vcpu))update_timer_ints (vcpu); +#if defined(CONFIG_KVM_E500V2 ) || defined(CONFIG_KVM_E500MC ) +if (kvm_check_request (KVM_REQ_TLB_FLUSH , vcpu)) +kvmppc_core_flush_tlb (vcpu); +#endif } }
@@ -579,6 +583,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)#endif kvm_guest_exit (); + vcpu->mode =OUTSIDE_GUEST_MODE ; +smp_wmb (); out: vcpu->mode =OUTSIDE_GUEST_MODE ;
arch/powerpc/kvm/e500_tlb.c +54 -6
90 lines not on this page · raw message
Signature · 1 line
1.6.0.2