KVM: Drop kvm_arch_{init,exit}() hooks
authorSean Christopherson <seanjc@google.com>
Wed, 30 Nov 2022 23:09:13 +0000 (23:09 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 29 Dec 2022 20:41:23 +0000 (15:41 -0500)
Drop kvm_arch_init() and kvm_arch_exit() now that all implementations
are nops.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com> # s390
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Anup Patel <anup@brainfault.org>
Message-Id: <20221130230934.1014142-30-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/arm64/kvm/arm.c
arch/mips/kvm/mips.c
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kvm/powerpc.c
arch/riscv/kvm/main.c
arch/s390/kvm/kvm-s390.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c

index ea8057fa113f16487fcddf08522929d1fc7f5afc..04ed741f7b9db4cc5731425ae1f0797236287aee 100644 (file)
@@ -2301,17 +2301,6 @@ out_err:
        return err;
 }
 
-int kvm_arch_init(void *opaque)
-{
-       return 0;
-}
-
-/* NOP: Compiling as a module not supported */
-void kvm_arch_exit(void)
-{
-
-}
-
 static int __init early_kvm_mode_cfg(char *arg)
 {
        if (!arg)
index ae7a24342fdf3e2358b1483c96ca578336c77502..3cade648827a0afdf61ac96d51486f8bbc8b20db 100644 (file)
@@ -1010,16 +1010,6 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
        return r;
 }
 
-int kvm_arch_init(void *opaque)
-{
-       return 0;
-}
-
-void kvm_arch_exit(void)
-{
-
-}
-
 int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
                                  struct kvm_sregs *sregs)
 {
index 5d2c3a487e7302fe9206ffe183d8fc8f6e018082..0a80e80c7b9e7735ade6df3dcbbe7f322ba008c7 100644 (file)
@@ -881,7 +881,6 @@ static inline void kvm_arch_sync_events(struct kvm *kvm) {}
 static inline void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen) {}
 static inline void kvm_arch_flush_shadow_all(struct kvm *kvm) {}
 static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
-static inline void kvm_arch_exit(void) {}
 static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
 static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
 
index d44b85ba8cef506d0db2cf0ccb47e39fa0b54f95..01d0f9935e6c2372fb814d97bd63ae8113eecf18 100644 (file)
@@ -2539,11 +2539,6 @@ void kvmppc_init_lpid(unsigned long nr_lpids_param)
 }
 EXPORT_SYMBOL_GPL(kvmppc_init_lpid);
 
-int kvm_arch_init(void *opaque)
-{
-       return 0;
-}
-
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ppc_instr);
 
 void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)
index 1cd220e96c26a87a91e68dd09faf82e1122c0edc..be951feee27a92bc7cf8644b17c7a68171d901a2 100644 (file)
@@ -65,15 +65,6 @@ void kvm_arch_hardware_disable(void)
        csr_write(CSR_HIDELEG, 0);
 }
 
-int kvm_arch_init(void *opaque)
-{
-       return 0;
-}
-
-void kvm_arch_exit(void)
-{
-}
-
 static int __init riscv_kvm_init(void)
 {
        const char *str;
index 66d162723d21eea5342f83cf38947f535d782bb2..25b08b956888e1223afef272f3f20fedd0f6f4c2 100644 (file)
@@ -541,16 +541,6 @@ static void __kvm_s390_exit(void)
        debug_unregister(kvm_s390_dbf_uv);
 }
 
-int kvm_arch_init(void *opaque)
-{
-       return 0;
-}
-
-void kvm_arch_exit(void)
-{
-
-}
-
 /* Section: device related */
 long kvm_arch_dev_ioctl(struct file *filp,
                        unsigned int ioctl, unsigned long arg)
index 78cb6a46dd50b057304accba54628539b392080b..accf5a7ab8dfbcd9bbcabf3a1b64d30fbd4fe2e8 100644 (file)
@@ -9292,16 +9292,6 @@ static inline void kvm_ops_update(struct kvm_x86_init_ops *ops)
        kvm_pmu_ops_update(ops->pmu_ops);
 }
 
-int kvm_arch_init(void *opaque)
-{
-       return 0;
-}
-
-void kvm_arch_exit(void)
-{
-
-}
-
 static int __kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
 {
        u64 host_pat;
index 7c1009c0e66dcd0ccdceb981cf4e89461b10b6b7..62d977bb1448c14918ae053937be72d0d7d6e514 100644 (file)
@@ -1423,9 +1423,6 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
                                        struct kvm_guest_debug *dbg);
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu);
 
-int kvm_arch_init(void *opaque);
-void kvm_arch_exit(void);
-
 void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu);
 
 void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
index 8393347fd35f86946d3d87881bb0757b1b239008..597ff734b3129a3ae9e20e9a29a823b32dfe6a2e 100644 (file)
@@ -5921,20 +5921,8 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
        int r;
        int cpu;
 
-       /*
-        * FIXME: Get rid of kvm_arch_init(), vendor code should call arch code
-        * directly.  Note, kvm_arch_init() _must_ be called before anything
-        * else as x86 relies on checks buried in kvm_arch_init() to guard
-        * against multiple calls to kvm_init().
-        */
-       r = kvm_arch_init(opaque);
-       if (r)
-               return r;
-
-       if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) {
-               r = -ENOMEM;
-               goto err_hw_enabled;
-       }
+       if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL))
+               return -ENOMEM;
 
        c.ret = &r;
        c.opaque = opaque;
@@ -6022,8 +6010,6 @@ out_free_3:
        cpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING);
 out_free_2:
        free_cpumask_var(cpus_hardware_enabled);
-err_hw_enabled:
-       kvm_arch_exit();
        return r;
 }
 EXPORT_SYMBOL_GPL(kvm_init);
@@ -6051,7 +6037,6 @@ void kvm_exit(void)
        on_each_cpu(hardware_disable_nolock, NULL, 1);
        kvm_irqfd_exit();
        free_cpumask_var(cpus_hardware_enabled);
-       kvm_arch_exit();
 }
 EXPORT_SYMBOL_GPL(kvm_exit);