[coreboot-gerrit] Change in coreboot[master]: cpu/x86: Use calculated set of vMTRRs in ap_init

Marshall Dawson (Code Review) gerrit at coreboot.org
Wed Apr 4 23:01:37 CEST 2018


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 at 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)
 {

-- 
To view, visit https://review.coreboot.org/25530
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5758d867423c0bf9e77a511af9c82ee4a1ca09d9
Gerrit-Change-Number: 25530
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180404/f45f3177/attachment-0001.html>


More information about the coreboot-gerrit mailing list