Skip to content

Commit b1e6845

Browse files
yliu80wenlingz
authored andcommitted
hv: enable vMCE from guest CPUID
Enable vMCE feature to boot windows guest. vMCE is set in EDX from Microsoft TLFS spec, to support windows guest vMCA and vMCE should be supported by guest CPUID. Support MSR_IA32_MCG_CAP and MSR_IA32_MCG_STATUS reading when vMCE is enabled, but they are not emulated yet, so return 0 directly. Tracked-On: #1867 Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Reviewed-by: Yu Wang <yu1.wang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 35ef11e commit b1e6845

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

hypervisor/arch/x86/guest/vcpuid.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,6 @@ void guest_cpuid(struct acrn_vcpu *vcpu, uint32_t *eax, uint32_t *ebx, uint32_t
366366
}
367367
}
368368

369-
/* mask Machine Check Exception */
370-
*edx &= ~CPUID_EDX_MCE;
371-
372369
/* mask Debug Store feature */
373370
*edx &= ~CPUID_EDX_DTES;
374371

hypervisor/arch/x86/guest/vmsr.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ static const uint32_t emulated_guest_msrs[NUM_GUEST_MSRS] = {
4444
MSR_IA32_APIC_BASE,
4545
MSR_IA32_PERF_CTL,
4646
MSR_IA32_FEATURE_CONTROL,
47+
48+
MSR_IA32_MCG_CAP,
49+
MSR_IA32_MCG_STATUS,
4750
};
4851

4952
#define NUM_MTRR_MSRS 13U
@@ -443,6 +446,12 @@ int32_t rdmsr_vmexit_handler(struct acrn_vcpu *vcpu)
443446
v = MSR_IA32_FEATURE_CONTROL_LOCK;
444447
break;
445448
}
449+
case MSR_IA32_MCG_CAP:
450+
case MSR_IA32_MCG_STATUS:
451+
{
452+
v = 0U;
453+
break;
454+
}
446455
default:
447456
{
448457
if (is_x2apic_msr(msr)) {
@@ -589,6 +598,8 @@ int32_t wrmsr_vmexit_handler(struct acrn_vcpu *vcpu)
589598
err = vlapic_set_apicbase(vcpu_vlapic(vcpu), v);
590599
break;
591600
}
601+
case MSR_IA32_MCG_CAP:
602+
case MSR_IA32_MCG_STATUS:
592603
case MSR_IA32_FEATURE_CONTROL:
593604
{
594605
err = -EACCES;

hypervisor/include/arch/x86/guest/vcpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ struct ext_context {
215215
#define SECURE_WORLD 1
216216

217217
#define NUM_WORLD_MSRS 2U
218-
#define NUM_COMMON_MSRS 7U
218+
#define NUM_COMMON_MSRS 9U
219219
#define NUM_GUEST_MSRS (NUM_WORLD_MSRS + NUM_COMMON_MSRS)
220220

221221
#define EOI_EXIT_BITMAP_SIZE 256U

0 commit comments

Comments
 (0)