2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-18 18:23:53 +08:00

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

Create cpu_svm_disable() function.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Eduardo Habkost 2008-11-17 19:03:21 -02:00 committed by Avi Kivity
parent 63d1142f8f
commit 2c8dceebb2
2 changed files with 15 additions and 5 deletions

View File

@ -107,4 +107,18 @@ static inline int cpu_has_svm(const char **msg)
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 */

View File

@ -259,11 +259,7 @@ static int has_svm(void)
static void svm_hardware_disable(void *garbage)
{
uint64_t efer;
wrmsrl(MSR_VM_HSAVE_PA, 0);
rdmsrl(MSR_EFER, efer);
wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
cpu_svm_disable();
}
static void svm_hardware_enable(void *garbage)