From 96331462b738dc1acdaa45ee5f258d5240659768 Mon Sep 17 00:00:00 2001 From: Binbin Wu Date: Fri, 20 Dec 2019 13:40:42 +0800 Subject: [PATCH] hv: vmcs: remove redundant check on vpid ACRN relies on the capability of VPID to avoid EPT flushes during VMX transitions. This capability is checked as a must have hardware capability, otherwise, ACRN will refuse to boot. Also, the current code has already made sure each vpid for a virtual cpu is valid. So, no need to check the validity of vpid for vcpu and enable VPID for vCPU by default. Tracked-On: #4296 Signed-off-by: Binbin Wu Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vmcs.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/hypervisor/arch/x86/guest/vmcs.c b/hypervisor/arch/x86/guest/vmcs.c index a125e2dee..d1f2c14cf 100644 --- a/hypervisor/arch/x86/guest/vmcs.c +++ b/hypervisor/arch/x86/guest/vmcs.c @@ -292,19 +292,13 @@ static void init_exec_ctrl(struct acrn_vcpu *vcpu) pr_dbg("VMX_PROC_VM_EXEC_CONTROLS: 0x%x ", value32); /* Set up secondary processor based VM execution controls - pg 2901 - * 24.6.2. Set up for: * Enable EPT * Enable RDTSCP * Unrestricted - * guest (optional) + * 24.6.2. Set up for: * Enable EPT * Eable VPID * Enable RDTSCP * + * Enable Unrestricted guest (optional) */ value32 = check_vmx_ctrl(MSR_IA32_VMX_PROCBASED_CTLS2, - VMX_PROCBASED_CTLS2_VAPIC | VMX_PROCBASED_CTLS2_EPT | + VMX_PROCBASED_CTLS2_VAPIC | VMX_PROCBASED_CTLS2_EPT |VMX_PROCBASED_CTLS2_VPID | VMX_PROCBASED_CTLS2_RDTSCP | VMX_PROCBASED_CTLS2_UNRESTRICT); - if (vcpu->arch.vpid != 0U) { - value32 |= VMX_PROCBASED_CTLS2_VPID; - } else { - value32 &= ~VMX_PROCBASED_CTLS2_VPID; - } - if (is_apicv_advanced_feature_supported()) { value32 |= VMX_PROCBASED_CTLS2_VIRQ; value32 |= VMX_PROCBASED_CTLS2_VAPIC_REGS;