diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 31ab5d1ef..8cb8c1312 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -219,6 +219,11 @@ static int hardware_detect_support(void) return -ENODEV; } + if (!cpu_has_cap(X86_FEATURE_MTRR)) { + pr_fatal("%s, MTRR not supported\n", __func__); + return -ENODEV; + } + if (!cpu_has_cap(X86_FEATURE_VMX)) { pr_fatal("%s, vmx not supported\n", __func__); return -ENODEV; diff --git a/hypervisor/arch/x86/mtrr.c b/hypervisor/arch/x86/mtrr.c index 1981a4488..5fbd32031 100755 --- a/hypervisor/arch/x86/mtrr.c +++ b/hypervisor/arch/x86/mtrr.c @@ -103,9 +103,8 @@ void init_mtrr(struct vcpu *vcpu) vcpu->mtrr.def_type.bits.fixed_enable = 1; vcpu->mtrr.def_type.bits.type = MTRR_MEM_TYPE_UC; - if (is_vm0(vcpu->vm) && cpu_has_cap(X86_FEATURE_MTRR)) { + if (is_vm0(vcpu->vm)) cap.value = msr_read(MSR_IA32_MTRR_CAP); - } for (i = 0; i < FIXED_RANGE_MTRR_NUM; i++) { if (cap.bits.fix) {