From 4732f8a4b03ce294624adad6b13fba46d689589c Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Mon, 17 Nov 2008 19:03:21 -0200 Subject: [PATCH] --- yaml --- r: 125237 b: refs/heads/master c: 2c8dceebb238680d5577500f8283397d41ca5590 h: refs/heads/master i: 125235: 7db2ad285865c1b08a036656cb8e63399a92f7f3 v: v3 --- [refs] | 2 +- trunk/arch/x86/include/asm/virtext.h | 14 ++++++++++++++ trunk/arch/x86/kvm/svm.c | 6 +----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 9313034a09b4..a3ee9de3d873 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 63d1142f8f69e39468bc6079ab2239e902828134 +refs/heads/master: 2c8dceebb238680d5577500f8283397d41ca5590 diff --git a/trunk/arch/x86/include/asm/virtext.h b/trunk/arch/x86/include/asm/virtext.h index 6f0d409c3682..2cfe363729c3 100644 --- a/trunk/arch/x86/include/asm/virtext.h +++ b/trunk/arch/x86/include/asm/virtext.h @@ -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 */ diff --git a/trunk/arch/x86/kvm/svm.c b/trunk/arch/x86/kvm/svm.c index 0667c6d13d30..1452851ae258 100644 --- a/trunk/arch/x86/kvm/svm.c +++ b/trunk/arch/x86/kvm/svm.c @@ -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)