diff options
-rw-r--r-- | arch/x86/include/asm/virtext.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h index 7dee5b59930e..6bcf0acb4ef1 100644 --- a/arch/x86/include/asm/virtext.h +++ b/arch/x86/include/asm/virtext.h | |||
@@ -43,4 +43,27 @@ static inline void cpu_vmxoff(void) | |||
43 | write_cr4(read_cr4() & ~X86_CR4_VMXE); | 43 | write_cr4(read_cr4() & ~X86_CR4_VMXE); |
44 | } | 44 | } |
45 | 45 | ||
46 | static inline int cpu_vmx_enabled(void) | ||
47 | { | ||
48 | return read_cr4() & X86_CR4_VMXE; | ||
49 | } | ||
50 | |||
51 | /** Disable VMX if it is enabled on the current CPU | ||
52 | * | ||
53 | * You shouldn't call this if cpu_has_vmx() returns 0. | ||
54 | */ | ||
55 | static inline void __cpu_emergency_vmxoff(void) | ||
56 | { | ||
57 | if (cpu_vmx_enabled()) | ||
58 | cpu_vmxoff(); | ||
59 | } | ||
60 | |||
61 | /** Disable VMX if it is supported and enabled on the current CPU | ||
62 | */ | ||
63 | static inline void cpu_emergency_vmxoff(void) | ||
64 | { | ||
65 | if (cpu_has_vmx()) | ||
66 | __cpu_emergency_vmxoff(); | ||
67 | } | ||
68 | |||
46 | #endif /* _ASM_X86_VIRTEX_H */ | 69 | #endif /* _ASM_X86_VIRTEX_H */ |