From e92320cf56c0e76313306862969b63dbd909c00e Mon Sep 17 00:00:00 2001 From: Jiaqing Zhao Date: Fri, 16 Jun 2023 06:55:54 +0000 Subject: [PATCH] hv: allow non-service vm to read MSR_PLATFORM_INFO (CEh) Guests bootloader may read MSR_PLATFORM_INFO to get TSC frequency for time measurement, so injecting #GP on read may crash the vm on boot. This patch emulates MSR_PLATFORM_INFO with 0, same behavior in kvm, to tell the guest it's a virtualized environment. Tracked-On: #8406 Reviewed-by: Junjie Mao Signed-off-by: Jiaqing Zhao --- hypervisor/arch/x86/guest/vmsr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hypervisor/arch/x86/guest/vmsr.c b/hypervisor/arch/x86/guest/vmsr.c index 3d9670464..ede0ccdad 100644 --- a/hypervisor/arch/x86/guest/vmsr.c +++ b/hypervisor/arch/x86/guest/vmsr.c @@ -797,7 +797,9 @@ int32_t rdmsr_vmexit_handler(struct acrn_vcpu *vcpu) MSR_PLATFORM_INFO_MIN_OPERATING_RATIO_MASK | MSR_PLATFORM_INFO_SAMPLE_PART; } else { - err = -EACCES; + /* Allow read by non-service vm for compatibility */ + v = 0UL; + pr_warn("%s(): vm%d read MSR_PLATFORM_INFO", __func__, vcpu->vm->vm_id); } break; }