From b59e5a870ab4dfdcd3989a60b913c24f1d7e49bf Mon Sep 17 00:00:00 2001 From: Shuo A Liu Date: Fri, 10 Jan 2020 13:57:13 +0800 Subject: [PATCH] hv: Disable HLT and PAUSE-loop exiting emulation in lapic passthrough In lapic passthrough mode, it should passthrough HLT/PAUSE execution too. This patch disable their emulation when switch to lapic passthrough mode. Tracked-On: #4329 Tested-by: Dongsheng Zhang Signed-off-by: Shuo A Liu Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vmcs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hypervisor/arch/x86/guest/vmcs.c b/hypervisor/arch/x86/guest/vmcs.c index 75a2893cd..10cca348c 100644 --- a/hypervisor/arch/x86/guest/vmcs.c +++ b/hypervisor/arch/x86/guest/vmcs.c @@ -599,11 +599,13 @@ void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu) value32 = exec_vmread32(VMX_PROC_VM_EXEC_CONTROLS); value32 &= ~VMX_PROCBASED_CTLS_TPR_SHADOW; + value32 &= ~VMX_PROCBASED_CTLS_HLT; exec_vmwrite32(VMX_PROC_VM_EXEC_CONTROLS, value32); exec_vmwrite32(VMX_TPR_THRESHOLD, 0U); value32 = exec_vmread32(VMX_PROC_VM_EXEC_CONTROLS2); + value32 &= ~VMX_PROCBASED_CTLS2_PAUSE_LOOP; value32 &= ~VMX_PROCBASED_CTLS2_VAPIC; if (is_apicv_advanced_feature_supported()) { value32 &= ~VMX_PROCBASED_CTLS2_VIRQ;