mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
vmx: Better diagnostic messages when VMXON might have failed due to
bad setting of the IA32_FEATURE_CONTROL MSR. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
This commit is contained in:
1 parent
a42d40a38b
commit
d44e3c1d2e
2 files changed
+24
-5
No files matched your search
@@ -267,7 +267,7 @@ static void vmx_load_vmcs(struct vcpu *v)
|
||||
int vmx_cpu_up(void)
|
||||
{
|
||||
u32 eax, edx;
|
||||
int cpu = smp_processor_id();
|
||||
int bios_locked, cpu = smp_processor_id();
|
||||
u64 cr0, vmx_cr0_fixed0, vmx_cr0_fixed1;
|
||||
|
||||
BUG_ON(!(read_cr4() & X86_CR4_VMXE));
|
||||
@@ -288,7 +288,8 @@ int vmx_cpu_up(void)
|
||||
|
||||
rdmsr(IA32_FEATURE_CONTROL_MSR, eax, edx);
|
||||
|
||||
if ( eax & IA32_FEATURE_CONTROL_MSR_LOCK )
|
||||
bios_locked = !!(eax & IA32_FEATURE_CONTROL_MSR_LOCK);
|
||||
if ( bios_locked )
|
||||
{
|
||||
if ( !(eax & (IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_OUTSIDE_SMX |
|
||||
IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_INSIDE_SMX)) )
|
||||
@@ -320,10 +321,28 @@ int vmx_cpu_up(void)
|
||||
}
|
||||
}
|
||||
|
||||
if ( __vmxon(virt_to_maddr(this_cpu(host_vmcs))) )
|
||||
switch ( __vmxon(virt_to_maddr(this_cpu(host_vmcs))) )
|
||||
{
|
||||
printk("CPU%d: VMXON failed\n", cpu);
|
||||
case -2: /* #UD or #GP */
|
||||
if ( bios_locked &&
|
||||
test_bit(X86_FEATURE_SMXE, &boot_cpu_data.x86_capability) &&
|
||||
(!(eax & IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_OUTSIDE_SMX) ||
|
||||
!(eax & IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_INSIDE_SMX)) )
|
||||
{
|
||||
printk("CPU%d: VMXON failed: perhaps because of TXT settings "
|
||||
"in your BIOS configuration?\n", cpu);
|
||||
printk(" --> Disable TXT in your BIOS unless using a secure "
|
||||
"bootloader.\n");
|
||||
return 0;
|
||||
}
|
||||
/* fall through */
|
||||
case -1: /* CF==1 or ZF==1 */
|
||||
printk("CPU%d: unexpected VMXON failure\n", cpu);
|
||||
return 0;
|
||||
case 0: /* success */
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
ept_sync_all();
|
||||
|
||||
@@ -334,7 +334,7 @@ static inline int __vmxon(u64 addr)
|
||||
" setna %b0 ; neg %0\n" /* CF==1 or ZF==1 --> rc = -1 */
|
||||
"2:\n"
|
||||
".section .fixup,\"ax\"\n"
|
||||
"3: not %0 ; jmp 2b\n" /* #UD --> rc = -1 */
|
||||
"3: sub $2,%0 ; jmp 2b\n" /* #UD or #GP --> rc = -2 */
|
||||
".previous\n"
|
||||
".section __ex_table,\"a\"\n"
|
||||
" "__FIXUP_ALIGN"\n"
|
||||
|
||||