Skip to content

Commit 486a8e4

Browse files
committed
x86/mtrr: Check if fixed-range MTRR exists in mtrr_save_fixed_ranges()
When suspending, save_processor_state() calls mtrr_save_fixed_ranges() to save fixed-range MTRRs. On platforms without fixed-range MTRRs, accessing these MSRs will trigger unchecked MSR access error. Make sure fixed-range MTRRs are supported before access to prevent such error. Since mtrr_state.have_fixed is only set when MTRRs are present and enabled, checking the CPU feature flag in mtrr_save_fixed_ranges() is unnecessary. Fixes: 3ebad59 ("[PATCH] x86: Save and restore the fixed-range MTRRs of the BSP when suspending") Tracked-On: OAM-132455 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
1 parent 28ae3c0 commit 486a8e4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/kernel/cpu/mtrr/generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static void get_fixed_ranges(mtrr_type *frs)
591591

592592
void mtrr_save_fixed_ranges(void *info)
593593
{
594-
if (boot_cpu_has(X86_FEATURE_MTRR))
594+
if (mtrr_state.have_fixed)
595595
get_fixed_ranges(mtrr_state.fixed_ranges);
596596
}
597597

0 commit comments

Comments
 (0)