mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-26 15:31:35 +00:00
HV: add MTRR capability check when CPU boot
- to avoid reading operations on MTRR registers if no MTRR feature support on current platform in "init_mtrr()". Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
parent
f67951bf17
commit
9beb1b92b5
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user