From: George Dunlap Subject: [PATCH] xen: Try to work around a BIOS that disables SVM but does not lock it Date: Wed, 7 Mar 2012 17:59:42 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com Cc: george.dunlap@eu.citrix.com List-Id: xen-devel@lists.xenproject.org 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 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