mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
KVM: Drop kvm_arch_check_processor_compat() hook
Drop kvm_arch_check_processor_compat() and its support code now that all architecture implementations are nops. Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Eric Farman <farman@linux.ibm.com> # s390 Acked-by: Anup Patel <anup@brainfault.org> Reviewed-by: Kai Huang <kai.huang@intel.com> Message-Id: <20221130230934.1014142-33-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
3045c483ee
commit
81a1cf9f89
@ -63,11 +63,6 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
|
||||
return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE;
|
||||
}
|
||||
|
||||
int kvm_arch_check_processor_compat(void *opaque)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
|
||||
struct kvm_enable_cap *cap)
|
||||
{
|
||||
@ -2285,7 +2280,7 @@ static __init int kvm_arm_init(void)
|
||||
* FIXME: Do something reasonable if kvm_init() fails after pKVM
|
||||
* hypervisor protection is finalized.
|
||||
*/
|
||||
err = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
err = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
if (err)
|
||||
goto out_subs;
|
||||
|
||||
|
@ -135,11 +135,6 @@ void kvm_arch_hardware_disable(void)
|
||||
kvm_mips_callbacks->hardware_disable();
|
||||
}
|
||||
|
||||
int kvm_arch_check_processor_compat(void *opaque)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern void kvm_init_loongson_ipi(struct kvm *kvm);
|
||||
|
||||
int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
|
||||
@ -1636,7 +1631,7 @@ static int __init kvm_mips_init(void)
|
||||
|
||||
register_die_notifier(&kvm_mips_csr_die_notifier);
|
||||
|
||||
ret = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
ret = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
if (ret) {
|
||||
unregister_die_notifier(&kvm_mips_csr_die_notifier);
|
||||
return ret;
|
||||
|
@ -1052,7 +1052,7 @@ static int kvmppc_book3s_init(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
r = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
if (r)
|
||||
return r;
|
||||
#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
|
||||
|
@ -531,7 +531,7 @@ static int __init kvmppc_e500_init(void)
|
||||
flush_icache_range(kvmppc_booke_handlers, kvmppc_booke_handlers +
|
||||
ivor[max_ivor] + handler_len);
|
||||
|
||||
r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
|
||||
r = kvm_init(sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
|
||||
if (r)
|
||||
goto err_out;
|
||||
kvm_ops_e500.owner = THIS_MODULE;
|
||||
|
@ -404,7 +404,7 @@ static int __init kvmppc_e500mc_init(void)
|
||||
*/
|
||||
kvmppc_init_lpid(KVMPPC_NR_LPIDS/threads_per_core);
|
||||
|
||||
r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
|
||||
r = kvm_init(sizeof(struct kvmppc_vcpu_e500), 0, THIS_MODULE);
|
||||
if (r)
|
||||
goto err_out;
|
||||
kvm_ops_e500mc.owner = THIS_MODULE;
|
||||
|
@ -440,11 +440,6 @@ int kvm_arch_hardware_enable(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kvm_arch_check_processor_compat(void *opaque)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
|
||||
{
|
||||
struct kvmppc_ops *kvm_ops = NULL;
|
||||
|
@ -20,11 +20,6 @@ long kvm_arch_dev_ioctl(struct file *filp,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int kvm_arch_check_processor_compat(void *opaque)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kvm_arch_hardware_enable(void)
|
||||
{
|
||||
unsigned long hideleg, hedeleg;
|
||||
@ -110,7 +105,7 @@ static int __init riscv_kvm_init(void)
|
||||
|
||||
kvm_info("VMID %ld bits available\n", kvm_riscv_gstage_vmid_bits());
|
||||
|
||||
return kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
return kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
}
|
||||
module_init(riscv_kvm_init);
|
||||
|
||||
|
@ -262,11 +262,6 @@ int kvm_arch_hardware_enable(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kvm_arch_check_processor_compat(void *opaque)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* forward declarations */
|
||||
static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
|
||||
unsigned long end);
|
||||
@ -5716,7 +5711,7 @@ static int __init kvm_s390_init(void)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
r = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE);
|
||||
if (r) {
|
||||
__kvm_s390_exit();
|
||||
return r;
|
||||
|
@ -5109,8 +5109,8 @@ static int __init svm_init(void)
|
||||
* Common KVM initialization _must_ come last, after this, /dev/kvm is
|
||||
* exposed to userspace!
|
||||
*/
|
||||
r = kvm_init(NULL, sizeof(struct vcpu_svm),
|
||||
__alignof__(struct vcpu_svm), THIS_MODULE);
|
||||
r = kvm_init(sizeof(struct vcpu_svm), __alignof__(struct vcpu_svm),
|
||||
THIS_MODULE);
|
||||
if (r)
|
||||
goto err_kvm_init;
|
||||
|
||||
|
@ -8635,8 +8635,8 @@ static int __init vmx_init(void)
|
||||
* Common KVM initialization _must_ come last, after this, /dev/kvm is
|
||||
* exposed to userspace!
|
||||
*/
|
||||
r = kvm_init(NULL, sizeof(struct vcpu_vmx),
|
||||
__alignof__(struct vcpu_vmx), THIS_MODULE);
|
||||
r = kvm_init(sizeof(struct vcpu_vmx), __alignof__(struct vcpu_vmx),
|
||||
THIS_MODULE);
|
||||
if (r)
|
||||
goto err_kvm_init;
|
||||
|
||||
|
@ -12084,11 +12084,6 @@ void kvm_arch_hardware_disable(void)
|
||||
drop_user_return_notifiers();
|
||||
}
|
||||
|
||||
int kvm_arch_check_processor_compat(void *opaque)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
|
||||
|
@ -956,8 +956,7 @@ static inline void kvm_irqfd_exit(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
|
||||
struct module *module);
|
||||
int kvm_init(unsigned vcpu_size, unsigned vcpu_align, struct module *module);
|
||||
void kvm_exit(void);
|
||||
|
||||
void kvm_get_kvm(struct kvm *kvm);
|
||||
@ -1444,7 +1443,6 @@ static inline void kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) {}
|
||||
|
||||
int kvm_arch_hardware_enable(void);
|
||||
void kvm_arch_hardware_disable(void);
|
||||
int kvm_arch_check_processor_compat(void *opaque);
|
||||
int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
|
||||
bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu);
|
||||
int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
|
||||
|
@ -5902,36 +5902,14 @@ void kvm_unregister_perf_callbacks(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
struct kvm_cpu_compat_check {
|
||||
void *opaque;
|
||||
int *ret;
|
||||
};
|
||||
|
||||
static void check_processor_compat(void *data)
|
||||
int kvm_init(unsigned vcpu_size, unsigned vcpu_align, struct module *module)
|
||||
{
|
||||
struct kvm_cpu_compat_check *c = data;
|
||||
|
||||
*c->ret = kvm_arch_check_processor_compat(c->opaque);
|
||||
}
|
||||
|
||||
int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
|
||||
struct module *module)
|
||||
{
|
||||
struct kvm_cpu_compat_check c;
|
||||
int r;
|
||||
int cpu;
|
||||
|
||||
if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL))
|
||||
return -ENOMEM;
|
||||
|
||||
c.ret = &r;
|
||||
c.opaque = opaque;
|
||||
for_each_online_cpu(cpu) {
|
||||
smp_call_function_single(cpu, check_processor_compat, &c, 1);
|
||||
if (r < 0)
|
||||
goto out_free_2;
|
||||
}
|
||||
|
||||
r = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_STARTING, "kvm/cpu:starting",
|
||||
kvm_starting_cpu, kvm_dying_cpu);
|
||||
if (r)
|
||||
|
Loading…
Reference in New Issue
Block a user