George Dunlap
2012-Mar-07 17:59 UTC
[PATCH] 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. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -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; } diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h --- a/xen/include/asm-x86/msr-index.h +++ b/xen/include/asm-x86/msr-index.h @@ -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
George Dunlap
2012-Mar-07 18:04 UTC
Re: [PATCH] xen: Try to work around a BIOS that disables SVM but does not lock it
On Wed, Mar 7, 2012 at 5:59 PM, George Dunlap <george.dunlap@eu.citrix.com> wrote:> 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 <george.dunlap@eu.citrix.com>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> > diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c > --- a/xen/arch/x86/hvm/svm/svm.c > +++ b/xen/arch/x86/hvm/svm/svm.c > @@ -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; > } > > diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h > --- a/xen/include/asm-x86/msr-index.h > +++ b/xen/include/asm-x86/msr-index.h > @@ -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 > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
Jan Beulich
2012-Mar-08 10:19 UTC
Re: [PATCH] xen: Try to work around a BIOS that disables SVM but does not lock it
>>> On 07.03.12 at 18:59, George Dunlap <george.dunlap@eu.citrix.com> wrote: > --- a/xen/arch/x86/hvm/svm/svm.c > +++ b/xen/arch/x86/hvm/svm/svm.c > @@ -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;Returning success when you weren''t able to enable SVM?> + } > return -EINVAL;And failure when it worked?> } >Also, shouldn''t overriding of a BIOS setting be gated by a default-off command line option? Jan
Tim Deegan
2012-Mar-08 11:32 UTC
Re: [PATCH] xen: Try to work around a BIOS that disables SVM but does not lock it
At 18:04 +0000 on 07 Mar (1331143469), George Dunlap wrote:> On Wed, Mar 7, 2012 at 5:59 PM, George Dunlap > <george.dunlap@eu.citrix.com> wrote: > > 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 <george.dunlap@eu.citrix.com> > > 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