1
0
mirror of https://github.com/projectacrn/acrn-hypervisor.git synced 2025-05-05 23:16:59 +00:00

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: 
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
This commit is contained in:
Jiaqing Zhao 2023-06-16 06:55:54 +00:00 committed by acrnsi-robot
parent db83648a8d
commit e92320cf56

View File

@ -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;
}