提交 2c8dceeb 编写于 作者: E Eduardo Habkost 提交者: Avi Kivity

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

Create cpu_svm_disable() function.
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册