xen: Try to work around a BIOS that disables SVM but does not lock it
PATCH 1/1 xen: Try to work around a BIOS that disables SVM but does not lock it
This is for a particular system we found with this problem; a HP DL785 with BIOS dated 08/22/2008.
xen/arch/x86/hvm/svm/svm.c +12 -1
@@ -1145,7 +1145,18 @@ static int svm_cpu_up(void)rdmsrl (MSR_K8_VM_CR , msr_content);if ( msr_content &K8_VMCR_SVME_DISABLE ) { -printk ("CPU%d: AMD SVM Extension is disabled in BIOS.\n" , cpu); +/* Try to re-enable it if we're allowed */ +if ( !(msr_content &K8_VMCR_SVME_LOCK ) ) + { + msr_content &= ~K8_VMCR_SVME_DISABLE ; +wrmsrl (MSR_K8_VM_CR , msr_content); +rdmsrl (MSR_K8_VM_CR , msr_content); + } +if ( msr_content &K8_VMCR_SVME_DISABLE ) + { +printk ("AMD SVM Extension is disabled in BIOS.\n" ); +return 0 ; + }return -EINVAL ; }
xen/include/asm-x86/msr-index.h +2 -0
@@ -198,6 +198,8 @@/* MSR_K8_VM_CR bits: */ #define _K8_VMCR_SVME_DISABLE 4#define K8_VMCR_SVME_DISABLE (1 << _K8_VMCR_SVME_DISABLE) +#define _K8_VMCR_SVME_LOCK 3 +#define K8_VMCR_SVME_LOCK (1 << _K8_VMCR_SVME_LOCK)/* AMD64 MSRs */ #define MSR_AMD64_NB_CFG 0xc001001f
Quoted 4 lines · George Dunlap
This is for a particular system we found with this problem; a HP DL785 with BIOS dated 08/22/2008.
Signed-off-by George Dunlap <[email protected]>
Hmm, actually, looking at our ticket (CA-24173, for those who have access to it), I'm not sure this was ever actually shown to fix the bug. Tim, can you comment?
-George
Quoted 41 lines
xen/arch/x86/hvm/svm/svm.c +12
-1@@ -1145,7 +1145,18 @@ static int svm_cpu_up(void) rdmsrl(MSR_K8_VM_CR, msr_content); if ( msr_content & K8_VMCR_SVME_DISABLE ) { - printk("CPU%d: AMD SVM Extension is disabled in BIOS.\n", cpu); + /* Try to re-enable it if we're allowed */ + if ( !(msr_content & K8_VMCR_SVME_LOCK) ) + { + msr_content &= ~K8_VMCR_SVME_DISABLE; + wrmsrl(MSR_K8_VM_CR, msr_content); + rdmsrl(MSR_K8_VM_CR, msr_content); + } + if ( msr_content & K8_VMCR_SVME_DISABLE ) + { + printk("AMD SVM Extension is disabled in BIOS.\n"); + return 0; + } return -EINVAL; }xen/include/asm-x86/msr-index.h +2
-0@@ -198,6 +198,8 @@ /* MSR_K8_VM_CR bits: */ #define _K8_VMCR_SVME_DISABLE 4 #define K8_VMCR_SVME_DISABLE (1 << _K8_VMCR_SVME_DISABLE) +#define _K8_VMCR_SVME_LOCK 3 +#define K8_VMCR_SVME_LOCK (1 << _K8_VMCR_SVME_LOCK) /* AMD64 MSRs */ #define MSR_AMD64_NB_CFG 0xc001001f_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · George Dunlap
Quoted 4 lines · George Dunlap
This is for a particular system we found with this problem; a HP DL785 with BIOS dated 08/22/2008.
Signed-off-by George Dunlap <[email protected]>Hmm, actually, looking at our ticket (CA-24173, for those who have access to it), I'm not sure this was ever actually shown to fix the bug. Tim, can you comment?
I'm afraid I can't remember any more than is on the ticket - that was more than two years ago. :) Do you still have one of these machines in service to test it?
TBH, though, the 'disabled but not locked' state is a BIOS bug - esp. since the ticket says that the BIOS claimed SVM was enabled. IIRC I put this patch in because we were very close to a product release at the time and we couldn't be sure that we wouldn't hit this problem on a lot of other customer h/w.
Tim
Quoted 9 lines
Quoted 1 line
Quoted 1 line · George Dunlap
xen/arch/x86/hvm/svm/svm.c +1
-1@@ -1145,7 +1145,18 @@ static int svm_cpu_up(void)rdmsrl (MSR_K8_VM_CR , msr_content);if ( msr_content &K8_VMCR_SVME_DISABLE ) { -printk ("CPU%d: AMD SVM Extension is disabled in BIOS.\n" , cpu); +/* Try to re-enable it if we're allowed */
xen/arch/x86/hvm/svm/svm.c static int svm_cpu_up(void) · line 1158
Quoted 10 lines
xen/arch/x86/hvm/svm/svm.c +10
-0+if ( !(msr_content &K8_VMCR_SVME_LOCK ) ) + { + msr_content &= ~K8_VMCR_SVME_DISABLE ; +wrmsrl (MSR_K8_VM_CR , msr_content); +rdmsrl (MSR_K8_VM_CR , msr_content); + } +if ( msr_content &K8_VMCR_SVME_DISABLE ) + { +printk ("AMD SVM Extension is disabled in BIOS.\n" ); +return 0 ;
Returning success when you weren't able to enable SVM?
xen/arch/x86/hvm/svm/svm.c static int svm_cpu_up(void) · line 1160
Quoted 2 lines
xen/arch/x86/hvm/svm/svm.c +1
-0+ }return -EINVAL ;
And failure when it worked?
xen/arch/x86/hvm/svm/svm.c static int svm_cpu_up(void) · line 1162
Quoted 2 lines
xen/arch/x86/hvm/svm/svm.c +0
-0}
Also, shouldn't overriding of a BIOS setting be gated by a default-off command line option?
Jan