aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Har'El <nyh@il.ibm.com>2013-08-07 08:59:22 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2013-08-07 09:57:43 -0400
commitafa61f752ba62549e4143d9f9378a8d1d710d6eb (patch)
tree0a3a6afad32c30edb39b88732b9c5096991e634e
parentbfd0a56b90005f8c8a004baf407ad90045c2b11e (diff)
Advertise the support of EPT to the L1 guest, through the appropriate MSR.
This is the last patch of the basic Nested EPT feature, so as to allow bisection through this patch series: The guest will not see EPT support until this last patch, and will not attempt to use the half-applied feature. Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Nadav Har'El <nyh@il.ibm.com> Signed-off-by: Jun Nakajima <jun.nakajima@intel.com> Signed-off-by: Xinhao Xu <xinhao.xu@intel.com> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/vmx.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 5129ba3766c4..5e084d6509c6 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2250,6 +2250,22 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2250 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | 2250 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
2251 SECONDARY_EXEC_WBINVD_EXITING; 2251 SECONDARY_EXEC_WBINVD_EXITING;
2252 2252
2253 if (enable_ept) {
2254 /* nested EPT: emulate EPT also to L1 */
2255 nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT;
2256 nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT;
2257 nested_vmx_ept_caps |= VMX_EPT_INVEPT_BIT;
2258 nested_vmx_ept_caps &= vmx_capability.ept;
2259 /*
2260 * Since invept is completely emulated we support both global
2261 * and context invalidation independent of what host cpu
2262 * supports
2263 */
2264 nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT |
2265 VMX_EPT_EXTENT_CONTEXT_BIT;
2266 } else
2267 nested_vmx_ept_caps = 0;
2268
2253 /* miscellaneous data */ 2269 /* miscellaneous data */
2254 rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high); 2270 rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high);
2255 nested_vmx_misc_low &= VMX_MISC_PREEMPTION_TIMER_RATE_MASK | 2271 nested_vmx_misc_low &= VMX_MISC_PREEMPTION_TIMER_RATE_MASK |
@@ -2358,8 +2374,8 @@ static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2358 nested_vmx_secondary_ctls_high); 2374 nested_vmx_secondary_ctls_high);
2359 break; 2375 break;
2360 case MSR_IA32_VMX_EPT_VPID_CAP: 2376 case MSR_IA32_VMX_EPT_VPID_CAP:
2361 /* Currently, no nested ept or nested vpid */ 2377 /* Currently, no nested vpid support */
2362 *pdata = 0; 2378 *pdata = nested_vmx_ept_caps;
2363 break; 2379 break;
2364 default: 2380 default:
2365 return 0; 2381 return 0;