aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2016-11-16 12:36:47 -0500
committerJames Hogan <james.hogan@imgtec.com>2017-02-03 10:21:00 -0500
commit7a156e9f822d2eb6c294226aea2a4c12c05caa10 (patch)
tree34bdd5b0ce64c411b27d500b1e3b4f118e3e0e51
parent4c86460cbc03f32c3649f7aaf9104e6e65c88a61 (diff)
KVM: MIPS: Drop vm_init() callback
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
-rw-r--r--arch/mips/include/asm/kvm_host.h3
-rw-r--r--arch/mips/kvm/mips.c16
-rw-r--r--arch/mips/kvm/tlb.c3
-rw-r--r--arch/mips/kvm/trap_emul.c6
4 files changed, 0 insertions, 28 deletions
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index e38e11184c1c..95c86dab9b1b 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -121,8 +121,6 @@ static inline bool kvm_is_error_hva(unsigned long addr)
121 return IS_ERR_VALUE(addr); 121 return IS_ERR_VALUE(addr);
122} 122}
123 123
124extern atomic_t kvm_mips_instance;
125
126struct kvm_vm_stat { 124struct kvm_vm_stat {
127 ulong remote_tlb_flush; 125 ulong remote_tlb_flush;
128}; 126};
@@ -528,7 +526,6 @@ struct kvm_mips_callbacks {
528 int (*handle_msa_fpe)(struct kvm_vcpu *vcpu); 526 int (*handle_msa_fpe)(struct kvm_vcpu *vcpu);
529 int (*handle_fpe)(struct kvm_vcpu *vcpu); 527 int (*handle_fpe)(struct kvm_vcpu *vcpu);
530 int (*handle_msa_disabled)(struct kvm_vcpu *vcpu); 528 int (*handle_msa_disabled)(struct kvm_vcpu *vcpu);
531 int (*vm_init)(struct kvm *kvm);
532 int (*vcpu_init)(struct kvm_vcpu *vcpu); 529 int (*vcpu_init)(struct kvm_vcpu *vcpu);
533 void (*vcpu_uninit)(struct kvm_vcpu *vcpu); 530 void (*vcpu_uninit)(struct kvm_vcpu *vcpu);
534 int (*vcpu_setup)(struct kvm_vcpu *vcpu); 531 int (*vcpu_setup)(struct kvm_vcpu *vcpu);
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index c4fc52e39f34..07ce10e3627a 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -92,22 +92,8 @@ void kvm_arch_check_processor_compat(void *rtn)
92 *(int *)rtn = 0; 92 *(int *)rtn = 0;
93} 93}
94 94
95static void kvm_mips_init_vm_percpu(void *arg)
96{
97 struct kvm *kvm = (struct kvm *)arg;
98
99 kvm_mips_callbacks->vm_init(kvm);
100
101}
102
103int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) 95int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
104{ 96{
105 if (atomic_inc_return(&kvm_mips_instance) == 1) {
106 kvm_debug("%s: 1st KVM instance, setup host TLB parameters\n",
107 __func__);
108 on_each_cpu(kvm_mips_init_vm_percpu, kvm, 1);
109 }
110
111 return 0; 97 return 0;
112} 98}
113 99
@@ -150,8 +136,6 @@ void kvm_mips_free_vcpus(struct kvm *kvm)
150void kvm_arch_destroy_vm(struct kvm *kvm) 136void kvm_arch_destroy_vm(struct kvm *kvm)
151{ 137{
152 kvm_mips_free_vcpus(kvm); 138 kvm_mips_free_vcpus(kvm);
153
154 atomic_dec(&kvm_mips_instance);
155} 139}
156 140
157long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, 141long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl,
diff --git a/arch/mips/kvm/tlb.c b/arch/mips/kvm/tlb.c
index 919252662d5a..8af5fd2cb107 100644
--- a/arch/mips/kvm/tlb.c
+++ b/arch/mips/kvm/tlb.c
@@ -33,9 +33,6 @@
33#define KVM_GUEST_PC_TLB 0 33#define KVM_GUEST_PC_TLB 0
34#define KVM_GUEST_SP_TLB 1 34#define KVM_GUEST_SP_TLB 1
35 35
36atomic_t kvm_mips_instance;
37EXPORT_SYMBOL_GPL(kvm_mips_instance);
38
39static u32 kvm_mips_get_kernel_asid(struct kvm_vcpu *vcpu) 36static u32 kvm_mips_get_kernel_asid(struct kvm_vcpu *vcpu)
40{ 37{
41 struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm; 38 struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm;
diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c
index 6a56e48f4bfa..8bb82eaa4c91 100644
--- a/arch/mips/kvm/trap_emul.c
+++ b/arch/mips/kvm/trap_emul.c
@@ -429,11 +429,6 @@ static int kvm_trap_emul_handle_msa_disabled(struct kvm_vcpu *vcpu)
429 return ret; 429 return ret;
430} 430}
431 431
432static int kvm_trap_emul_vm_init(struct kvm *kvm)
433{
434 return 0;
435}
436
437static int kvm_trap_emul_vcpu_init(struct kvm_vcpu *vcpu) 432static int kvm_trap_emul_vcpu_init(struct kvm_vcpu *vcpu)
438{ 433{
439 struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm; 434 struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm;
@@ -847,7 +842,6 @@ static struct kvm_mips_callbacks kvm_trap_emul_callbacks = {
847 .handle_fpe = kvm_trap_emul_handle_fpe, 842 .handle_fpe = kvm_trap_emul_handle_fpe,
848 .handle_msa_disabled = kvm_trap_emul_handle_msa_disabled, 843 .handle_msa_disabled = kvm_trap_emul_handle_msa_disabled,
849 844
850 .vm_init = kvm_trap_emul_vm_init,
851 .vcpu_init = kvm_trap_emul_vcpu_init, 845 .vcpu_init = kvm_trap_emul_vcpu_init,
852 .vcpu_uninit = kvm_trap_emul_vcpu_uninit, 846 .vcpu_uninit = kvm_trap_emul_vcpu_uninit,
853 .vcpu_setup = kvm_trap_emul_vcpu_setup, 847 .vcpu_setup = kvm_trap_emul_vcpu_setup,