diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2013-03-06 09:44:03 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-03-07 13:47:11 -0500 |
commit | 33fb20c39e98b90813b5ab2d9a0d6faa6300caca (patch) | |
tree | 20402ecdcf02f39fdbd31a793702f29881c2fbbc /arch/x86 | |
parent | c4627c72e9c9e0fc35af2e9d612888fe4564377d (diff) |
KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS
Properly set those bits to 1 that the spec demands in case bit 55 of
VMX_BASIC is 0 - like in our case.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/vmx.h | 4 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index b6fbf860e398..5fb6e24f0649 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h | |||
@@ -81,6 +81,8 @@ | |||
81 | #define VM_EXIT_LOAD_IA32_EFER 0x00200000 | 81 | #define VM_EXIT_LOAD_IA32_EFER 0x00200000 |
82 | #define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER 0x00400000 | 82 | #define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER 0x00400000 |
83 | 83 | ||
84 | #define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR 0x00036dff | ||
85 | |||
84 | #define VM_ENTRY_LOAD_DEBUG_CONTROLS 0x00000002 | 86 | #define VM_ENTRY_LOAD_DEBUG_CONTROLS 0x00000002 |
85 | #define VM_ENTRY_IA32E_MODE 0x00000200 | 87 | #define VM_ENTRY_IA32E_MODE 0x00000200 |
86 | #define VM_ENTRY_SMM 0x00000400 | 88 | #define VM_ENTRY_SMM 0x00000400 |
@@ -89,6 +91,8 @@ | |||
89 | #define VM_ENTRY_LOAD_IA32_PAT 0x00004000 | 91 | #define VM_ENTRY_LOAD_IA32_PAT 0x00004000 |
90 | #define VM_ENTRY_LOAD_IA32_EFER 0x00008000 | 92 | #define VM_ENTRY_LOAD_IA32_EFER 0x00008000 |
91 | 93 | ||
94 | #define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR 0x000011ff | ||
95 | |||
92 | /* VMCS Encodings */ | 96 | /* VMCS Encodings */ |
93 | enum vmcs_field { | 97 | enum vmcs_field { |
94 | VIRTUAL_PROCESSOR_ID = 0x00000000, | 98 | VIRTUAL_PROCESSOR_ID = 0x00000000, |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index aacf6a458ae1..a9d885353108 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2049,21 +2049,28 @@ static __init void nested_vmx_setup_ctls_msrs(void) | |||
2049 | PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING | | 2049 | PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING | |
2050 | PIN_BASED_VIRTUAL_NMIS; | 2050 | PIN_BASED_VIRTUAL_NMIS; |
2051 | 2051 | ||
2052 | /* exit controls */ | 2052 | /* |
2053 | nested_vmx_exit_ctls_low = 0; | 2053 | * Exit controls |
2054 | * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and | ||
2055 | * 17 must be 1. | ||
2056 | */ | ||
2057 | nested_vmx_exit_ctls_low = VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR; | ||
2054 | /* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */ | 2058 | /* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */ |
2055 | #ifdef CONFIG_X86_64 | 2059 | #ifdef CONFIG_X86_64 |
2056 | nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE; | 2060 | nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE; |
2057 | #else | 2061 | #else |
2058 | nested_vmx_exit_ctls_high = 0; | 2062 | nested_vmx_exit_ctls_high = 0; |
2059 | #endif | 2063 | #endif |
2064 | nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR; | ||
2060 | 2065 | ||
2061 | /* entry controls */ | 2066 | /* entry controls */ |
2062 | rdmsr(MSR_IA32_VMX_ENTRY_CTLS, | 2067 | rdmsr(MSR_IA32_VMX_ENTRY_CTLS, |
2063 | nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high); | 2068 | nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high); |
2064 | nested_vmx_entry_ctls_low = 0; | 2069 | /* If bit 55 of VMX_BASIC is off, bits 0-8 and 12 must be 1. */ |
2070 | nested_vmx_entry_ctls_low = VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR; | ||
2065 | nested_vmx_entry_ctls_high &= | 2071 | nested_vmx_entry_ctls_high &= |
2066 | VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE; | 2072 | VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE; |
2073 | nested_vmx_entry_ctls_high |= VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR; | ||
2067 | 2074 | ||
2068 | /* cpu-based controls */ | 2075 | /* cpu-based controls */ |
2069 | rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, | 2076 | rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, |