aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2014-06-16 07:59:41 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-06-19 06:52:12 -0400
commit3dcdf3ec6e48d918741ea11349d4436d0c5aac93 (patch)
tree47595f1b874e4ac9b79ce8500e5f105226dc0f97 /arch/x86/kvm/vmx.c
parent3dbcd8da7b564194f93271b003a1c46ef404cbdb (diff)
KVM: nVMX: Allow to disable CR3 access interception
We already have this control enabled by exposing a broken MSR_IA32_VMX_PROCBASED_CTLS value. This will properly advertise our capability once the value is fixed by clearing the right bits in MSR_IA32_VMX_TRUE_PROCBASED_CTLS. We also have to ensure to test the right value on L2 entry. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 31379faf952e..e55e404b5dba 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2239,6 +2239,7 @@ static inline bool nested_vmx_allowed(struct kvm_vcpu *vcpu)
2239 * or other means. 2239 * or other means.
2240 */ 2240 */
2241static u32 nested_vmx_procbased_ctls_low, nested_vmx_procbased_ctls_high; 2241static u32 nested_vmx_procbased_ctls_low, nested_vmx_procbased_ctls_high;
2242static u32 nested_vmx_true_procbased_ctls_low;
2242static u32 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high; 2243static u32 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high;
2243static u32 nested_vmx_pinbased_ctls_low, nested_vmx_pinbased_ctls_high; 2244static u32 nested_vmx_pinbased_ctls_low, nested_vmx_pinbased_ctls_high;
2244static u32 nested_vmx_exit_ctls_low, nested_vmx_exit_ctls_high; 2245static u32 nested_vmx_exit_ctls_low, nested_vmx_exit_ctls_high;
@@ -2328,6 +2329,10 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2328 */ 2329 */
2329 nested_vmx_procbased_ctls_high |= CPU_BASED_USE_MSR_BITMAPS; 2330 nested_vmx_procbased_ctls_high |= CPU_BASED_USE_MSR_BITMAPS;
2330 2331
2332 /* We support free control of CR3 access interception. */
2333 nested_vmx_true_procbased_ctls_low = nested_vmx_procbased_ctls_low &
2334 ~(CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING);
2335
2331 /* secondary cpu-based controls */ 2336 /* secondary cpu-based controls */
2332 rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, 2337 rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2,
2333 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high); 2338 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high);
@@ -2395,6 +2400,9 @@ static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2395 nested_vmx_pinbased_ctls_high); 2400 nested_vmx_pinbased_ctls_high);
2396 break; 2401 break;
2397 case MSR_IA32_VMX_TRUE_PROCBASED_CTLS: 2402 case MSR_IA32_VMX_TRUE_PROCBASED_CTLS:
2403 *pdata = vmx_control_msr(nested_vmx_true_procbased_ctls_low,
2404 nested_vmx_procbased_ctls_high);
2405 break;
2398 case MSR_IA32_VMX_PROCBASED_CTLS: 2406 case MSR_IA32_VMX_PROCBASED_CTLS:
2399 *pdata = vmx_control_msr(nested_vmx_procbased_ctls_low, 2407 *pdata = vmx_control_msr(nested_vmx_procbased_ctls_low,
2400 nested_vmx_procbased_ctls_high); 2408 nested_vmx_procbased_ctls_high);
@@ -8127,7 +8135,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
8127 } 8135 }
8128 8136
8129 if (!vmx_control_verify(vmcs12->cpu_based_vm_exec_control, 8137 if (!vmx_control_verify(vmcs12->cpu_based_vm_exec_control,
8130 nested_vmx_procbased_ctls_low, nested_vmx_procbased_ctls_high) || 8138 nested_vmx_true_procbased_ctls_low,
8139 nested_vmx_procbased_ctls_high) ||
8131 !vmx_control_verify(vmcs12->secondary_vm_exec_control, 8140 !vmx_control_verify(vmcs12->secondary_vm_exec_control,
8132 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high) || 8141 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high) ||
8133 !vmx_control_verify(vmcs12->pin_based_vm_exec_control, 8142 !vmx_control_verify(vmcs12->pin_based_vm_exec_control,