diff options
author | Sean Christopherson <seanjc@google.com> | 2020-12-31 03:26:59 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-02-04 13:27:33 +0300 |
commit | 6a289139479845f12e44108b4d52cf0194bd5ff3 (patch) | |
tree | 89802c61a946500cce7116b05145237061cbf47d /arch/x86/include/asm/virtext.h | |
parent | 5ef940bd9ac267e5764ee886956352935dc7bad3 (diff) | |
download | linux-6a289139479845f12e44108b4d52cf0194bd5ff3.tar.xz |
KVM: VMX: Use the kernel's version of VMXOFF
Drop kvm_cpu_vmxoff() in favor of the kernel's cpu_vmxoff(). Modify the
latter to return -EIO on fault so that KVM can invoke
kvm_spurious_fault() when appropriate. In addition to the obvious code
reuse, dropping kvm_cpu_vmxoff() also eliminates VMX's last usage of the
__ex()/__kvm_handle_fault_on_reboot() macros, thus helping pave the way
toward dropping them entirely.
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20201231002702.2223707-7-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/virtext.h')
-rw-r--r-- | arch/x86/include/asm/virtext.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h index 2cc585467667..8757078d4442 100644 --- a/arch/x86/include/asm/virtext.h +++ b/arch/x86/include/asm/virtext.h @@ -41,13 +41,18 @@ static inline int cpu_has_vmx(void) * faults are guaranteed to be due to the !post-VMXON check unless the CPU is * magically in RM, VM86, compat mode, or at CPL>0. */ -static inline void cpu_vmxoff(void) +static inline int cpu_vmxoff(void) { asm_volatile_goto("1: vmxoff\n\t" _ASM_EXTABLE(1b, %l[fault]) ::: "cc", "memory" : fault); + + cr4_clear_bits(X86_CR4_VMXE); + return 0; + fault: cr4_clear_bits(X86_CR4_VMXE); + return -EIO; } static inline int cpu_vmx_enabled(void) |