Commit 2c8dceeb authored by Eduardo Habkost's avatar Eduardo Habkost Committed by Avi Kivity

KVM: SVM: move svm_hardware_disable() code to asm/virtext.h

Create cpu_svm_disable() function.
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 63d1142f
...@@ -107,4 +107,18 @@ static inline int cpu_has_svm(const char **msg) ...@@ -107,4 +107,18 @@ static inline int cpu_has_svm(const char **msg)
return 1; return 1;
} }
/** Disable SVM on the current CPU
*
* You should call this only if cpu_has_svm() returned true.
*/
static inline void cpu_svm_disable(void)
{
uint64_t efer;
wrmsrl(MSR_VM_HSAVE_PA, 0);
rdmsrl(MSR_EFER, efer);
wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
}
#endif /* _ASM_X86_VIRTEX_H */ #endif /* _ASM_X86_VIRTEX_H */
...@@ -259,11 +259,7 @@ static int has_svm(void) ...@@ -259,11 +259,7 @@ static int has_svm(void)
static void svm_hardware_disable(void *garbage) static void svm_hardware_disable(void *garbage)
{ {
uint64_t efer; cpu_svm_disable();
wrmsrl(MSR_VM_HSAVE_PA, 0);
rdmsrl(MSR_EFER, efer);
wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
} }
static void svm_hardware_enable(void *garbage) static void svm_hardware_enable(void *garbage)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment