KVM: MIPS: Drop vm_init() callback
authorJames Hogan <james.hogan@imgtec.com>
Wed, 16 Nov 2016 17:36:47 +0000 (17:36 +0000)
committerJames Hogan <james.hogan@imgtec.com>
Fri, 3 Feb 2017 15:21:00 +0000 (15:21 +0000)
Now that the commpage doesn't use wired TLB entries, the per-CPU
vm_init() callback is the only work done by kvm_mips_init_vm_percpu().

The trap & emulate implementation doesn't actually need to do anything
from vm_init(), and the future VZ implementation would be better served
by a kvm_arch_hardware_enable callback anyway.

Therefore drop the vm_init() callback entirely, allowing the
kvm_mips_init_vm_percpu() function to also be dropped, along with the
kvm_mips_instance atomic counter.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
arch/mips/include/asm/kvm_host.h
arch/mips/kvm/mips.c
arch/mips/kvm/tlb.c
arch/mips/kvm/trap_emul.c

index e38e11184c1c5cf0f087ba43725e509fde086df3..95c86dab9b1b60ccf287033ea51e7c1bce72ca8c 100644 (file)
@@ -121,8 +121,6 @@ static inline bool kvm_is_error_hva(unsigned long addr)
        return IS_ERR_VALUE(addr);
 }
 
-extern atomic_t kvm_mips_instance;
-
 struct kvm_vm_stat {
        ulong remote_tlb_flush;
 };
@@ -528,7 +526,6 @@ struct kvm_mips_callbacks {
        int (*handle_msa_fpe)(struct kvm_vcpu *vcpu);
        int (*handle_fpe)(struct kvm_vcpu *vcpu);
        int (*handle_msa_disabled)(struct kvm_vcpu *vcpu);
-       int (*vm_init)(struct kvm *kvm);
        int (*vcpu_init)(struct kvm_vcpu *vcpu);
        void (*vcpu_uninit)(struct kvm_vcpu *vcpu);
        int (*vcpu_setup)(struct kvm_vcpu *vcpu);
index c4fc52e39f34523d16ef56d3bca523416c7d674d..07ce10e3627a888541e37198e8e62f2f9b266676 100644 (file)
@@ -92,22 +92,8 @@ void kvm_arch_check_processor_compat(void *rtn)
        *(int *)rtn = 0;
 }
 
-static void kvm_mips_init_vm_percpu(void *arg)
-{
-       struct kvm *kvm = (struct kvm *)arg;
-
-       kvm_mips_callbacks->vm_init(kvm);
-
-}
-
 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 {
-       if (atomic_inc_return(&kvm_mips_instance) == 1) {
-               kvm_debug("%s: 1st KVM instance, setup host TLB parameters\n",
-                         __func__);
-               on_each_cpu(kvm_mips_init_vm_percpu, kvm, 1);
-       }
-
        return 0;
 }
 
@@ -150,8 +136,6 @@ void kvm_mips_free_vcpus(struct kvm *kvm)
 void kvm_arch_destroy_vm(struct kvm *kvm)
 {
        kvm_mips_free_vcpus(kvm);
-
-       atomic_dec(&kvm_mips_instance);
 }
 
 long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl,
index 919252662d5ace3906f2e351dfe5d9508fd0bc17..8af5fd2cb1071e305c034986e65fe9a13cecda17 100644 (file)
@@ -33,9 +33,6 @@
 #define KVM_GUEST_PC_TLB    0
 #define KVM_GUEST_SP_TLB    1
 
-atomic_t kvm_mips_instance;
-EXPORT_SYMBOL_GPL(kvm_mips_instance);
-
 static u32 kvm_mips_get_kernel_asid(struct kvm_vcpu *vcpu)
 {
        struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm;
index 6a56e48f4bfae9add4532e0bb34e672cbbb18a00..8bb82eaa4c914229a2e047d4b3da83a242f3a9db 100644 (file)
@@ -429,11 +429,6 @@ static int kvm_trap_emul_handle_msa_disabled(struct kvm_vcpu *vcpu)
        return ret;
 }
 
-static int kvm_trap_emul_vm_init(struct kvm *kvm)
-{
-       return 0;
-}
-
 static int kvm_trap_emul_vcpu_init(struct kvm_vcpu *vcpu)
 {
        struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm;
@@ -847,7 +842,6 @@ static struct kvm_mips_callbacks kvm_trap_emul_callbacks = {
        .handle_fpe = kvm_trap_emul_handle_fpe,
        .handle_msa_disabled = kvm_trap_emul_handle_msa_disabled,
 
-       .vm_init = kvm_trap_emul_vm_init,
        .vcpu_init = kvm_trap_emul_vcpu_init,
        .vcpu_uninit = kvm_trap_emul_vcpu_uninit,
        .vcpu_setup = kvm_trap_emul_vcpu_setup,