From 171856c46b01d3770f39ff85be9bf23df9921faa Mon Sep 17 00:00:00 2001 From: Tao Yuhong Date: Tue, 3 Aug 2021 09:14:40 -0400 Subject: [PATCH] hv: uc-lock: Fix do not trap #GP If HV enable trigger #GP for uc-lock, and is about to emulate guest uc-lock instructions, should trap guest #GP. Guest uc-lock instrucction trigger #GP, cause vmexit for #GP, HV handle this vmexit and emulate uc-lock instruction. Tracked-On: #6299 Signed-off-by: Tao Yuhong --- hypervisor/arch/x86/guest/vmcs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hypervisor/arch/x86/guest/vmcs.c b/hypervisor/arch/x86/guest/vmcs.c index 228587f01..c5c3e78eb 100644 --- a/hypervisor/arch/x86/guest/vmcs.c +++ b/hypervisor/arch/x86/guest/vmcs.c @@ -406,6 +406,9 @@ static void init_exec_ctrl(struct acrn_vcpu *vcpu) if (is_ac_enabled()) { value32 = (value32 | (1U << IDT_AC)); } + if (is_gp_enabled()) { + value32 = (value32 | (1U << IDT_GP)); + } exec_vmwrite32(VMX_EXCEPTION_BITMAP, value32); /* Set up page fault error code mask - second paragraph * pg 2902