#ifdef CONFIG_X86_64
if (hypervisor_is_type(X86_HYPER_MS_HYPERV))
- clear_hv_tscchange_cb();
- #endif
- kvm_lapic_exit();
-
- if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
- cpufreq_unregister_notifier(&kvmclock_cpufreq_notifier_block,
- CPUFREQ_TRANSITION_NOTIFIER);
- cpuhp_remove_state_nocalls(CPUHP_AP_X86_KVM_CLK_ONLINE);
- }
- #ifdef CONFIG_X86_64
- pvclock_gtod_unregister_notifier(&pvclock_gtod_notifier);
- irq_work_sync(&pvclock_irq_work);
- cancel_work_sync(&pvclock_gtod_work);
- #endif
- kvm_x86_call(hardware_unsetup)();
- kvm_mmu_vendor_module_exit();
- free_percpu(user_return_msrs);
- kmem_cache_destroy(x86_emulator_cache);
- #ifdef CONFIG_KVM_XEN
- static_key_deferred_flush(&kvm_xen_enabled);
- WARN_ON(static_branch_unlikely(&kvm_xen_enabled.key));
- #endif
- mutex_lock(&vendor_module_lock);
- kvm_x86_ops.enable_virtualization_cpu = NULL;
- mutex_unlock(&vendor_module_lock);
- }
- EXPORT_SYMBOL_GPL(kvm_x86_vendor_exit);
-
- static int __kvm_emulate_halt(struct kvm_vcpu *vcpu, int state, int reason)
- {
- /*
- * The vCPU has halted, e.g. executed HLT. Update the run state if the
- * local APIC is in-kernel, the run loop will detect the non-runnable
- * state and halt the vCPU. Exit to userspace if the local APIC is
- * managed by userspace, in which case userspace is responsible for
- * handling wake events.
- */
- ++vcpu->stat.halt_exits;
- if (lapic_in_kernel(vcpu)) {
- vcpu->arch.mp_state = state;
- return 1;
- } else {
- vcpu->run->exit_reason = reason;
- return 0;
- }
- }
-
- int kvm_emulate_halt_noskip(struct kvm_vcpu *vcpu)
- {
- return __kvm_emulate_halt(vcpu, KVM_MP_STATE_HALTED, KVM_EXIT_HLT);
- }
- EXPORT_SYMBOL_GPL(kvm_emulate_halt_noskip);
-
- int kvm_emulate_halt(struct kvm_vcpu *vcpu)
- {
- int ret = kvm_skip_emulated_instruction(vcpu);
- /*
- * TODO: we might be squashing a GUESTDBG_SINGLESTEP-triggered
- * KVM_EXIT_DEBUG here.
- */
- return kvm_emulate_halt_noskip(vcpu) && ret;
- }
- EXPORT_SYMBOL_GPL(kvm_emulate_halt);
-
- int kvm_emulate_ap_reset_hold(struct kvm_vcpu *vcpu)
- {
- int ret = kvm_skip_emulated_instruction(vcpu);
+ clear_hv_tscchange_cb();
+ #endif
+ kvm_lapic_exit();
- return __kvm_emulate_halt(vcpu, KVM_MP_STATE_AP_RESET_HOLD,
- KVM_EXIT_AP_RESET_HOLD) && ret;
+ if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
+ cpufreq_unregister_notifier(&kvmclock_cpufreq_notifier_block,
+ CPUFREQ_TRANSITION_NOTIFIER);
+ cpuhp_remove_state_nocalls(CPUHP_AP_X86_KVM_CLK_ONLINE);
+ }
+ #ifdef CONFIG_X86_64
+ pvclock_gtod_unregister_notifier(&pvclock_gtod_notifier);
+ irq_work_sync(&pvclock_irq_work);
+ cancel_work_sync(&pvclock_gtod_work);
+ #endif
+ kvm_x86_call(hardware_unsetup)();
+ kvm_mmu_vendor_module_exit();
+ free_percpu(user_return_msrs);
+ kmem_cache_destroy(x86_emulator_cache);
+ #ifdef CONFIG_KVM_XEN
+ static_key_deferred_flush(&kvm_xen_enabled);
+ WARN_ON(static_branch_unlikely(&kvm_xen_enabled.key));
+ #endif
+ mutex_lock(&vendor_module_lock);
- kvm_x86_ops.hardware_enable = NULL;
++ kvm_x86_ops.enable_virtualization_cpu = NULL;
+ mutex_unlock(&vendor_module_lock);
}
- EXPORT_SYMBOL_GPL(kvm_emulate_ap_reset_hold);
+ EXPORT_SYMBOL_GPL(kvm_x86_vendor_exit);
#ifdef CONFIG_X86_64
static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr,