Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/25530
Change subject: cpu/x86: Use calculated set of vMTRRs in ap_init ......................................................................
cpu/x86: Use calculated set of vMTRRs in ap_init
Make a generic function that loads a golden set of variable MTRRs on the core. Call from each AP in ap_init depending on the Kconfig option. This allows the BSP to take advantage of temporary MTRR settings without having them incorrectly reflected to the APs.
BUG=b:77457944 TEST=tested using change ID I96f50af
Change-Id: I5758d867423c0bf9e77a511af9c82ee4a1ca09d9 Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/cpu/x86/mp_init.c M src/cpu/x86/mtrr/mtrr.c M src/include/cpu/x86/mtrr.h 3 files changed, 12 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/25530/1
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index f8dfd3d..749843d 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -223,6 +223,10 @@ { struct cpu_info *info;
+ /* Mirrored sets MTRRs in sipi_vector.S. Use golden set otherwise. */ + if (!IS_ENABLED(CONFIG_X86_AP_VMTRRS_MIRROR_BSP)) + x86_set_final_mtrrs(); + /* Ensure the local APIC is enabled */ enable_lapic();
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c index 08312fb..aca835a 100644 --- a/src/cpu/x86/mtrr/mtrr.c +++ b/src/cpu/x86/mtrr/mtrr.c @@ -890,10 +890,15 @@ memranges_teardown(&addr_space); }
+void x86_set_final_mtrrs(void) +{ + commit_var_mtrrs(&mtrr_global_solution); +} + static void remove_temp_solution(void *unused) { if (put_back_original_solution) - commit_var_mtrrs(&mtrr_global_solution); + x86_set_final_mtrrs(); }
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, remove_temp_solution, NULL); diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h index 0d64be5..4584be8 100644 --- a/src/include/cpu/x86/mtrr.h +++ b/src/include/cpu/x86/mtrr.h @@ -93,6 +93,8 @@ unsigned int type); int get_free_var_mtrr(void);
+void x86_set_final_mtrrs(void); + /* fms: find most significant bit set, stolen from Linux Kernel Source. */ static inline unsigned int fms(unsigned int x) {