[coreboot-gerrit] Change in coreboot[master]: cpu/x86: Add Kconfig for mirroring BSP MTRRs

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


Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/25529


Change subject: cpu/x86: Add Kconfig for mirroring BSP MTRRs
......................................................................

cpu/x86: Add Kconfig for mirroring BSP MTRRs

All systems using the standard mp_init currently mirror the BSP's
variable MTRRs to each AP that is initialilized.  This is the first
of a series of patches that will convert ap_init to use a golden set
of calculated set of ranges instead.

Some implementations intend for the settings to be mirrored, so create
an option that will be used later only for those exceptions.  In the
mp_init function, check the option.

This first patch should have no functional effect on any system.

BUG=b:77457944
TEST=Run AMD Padmelon and observe no changes in MTRRs

Change-Id: I8c1bbc5f4b556cdc28099e3ed439202bbd8a7f49
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/cpu/x86/Kconfig
M src/cpu/x86/mp_init.c
2 files changed, 15 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/25529/1

diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig
index a20febb..679505b 100644
--- a/src/cpu/x86/Kconfig
+++ b/src/cpu/x86/Kconfig
@@ -137,6 +137,16 @@
 	  This option informs the MTRR code to use the RdMem and WrMem fields
 	  in the fixed MTRR MSRs.
 
+config X86_AP_VMTRRS_MIRROR_BSP
+	bool
+	default y
+	help
+	  Certain implementations may enter the common multi-processor
+	  initialization with the variable MTRRs already programmed, but
+	  others may elect to set them in the function member .pre_mp_init.
+	  This option allows the AP setup feature to exactly mirror the
+	  BSP's MTRR settings.
+
 config PLATFORM_USES_FSP1_0
 	bool
 	default n
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index f99abaf..f8dfd3d 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -288,8 +288,11 @@
 	msr_t msr;
 
 	/* Determine number of MTRRs need to be saved. */
-	msr = rdmsr(MTRR_CAP_MSR);
-	num_var_mtrrs = msr.lo & 0xff;
+	num_var_mtrrs = 0;
+	if (IS_ENABLED(CONFIG_X86_AP_VMTRRS_MIRROR_BSP)) {
+		msr = rdmsr(MTRR_CAP_MSR);
+		num_var_mtrrs = msr.lo & 0xff;
+	}
 
 	/* 2 * num_var_mtrrs for base and mask. +1 for IA32_MTRR_DEF_TYPE. */
 	msr_count = 2 * num_var_mtrrs + NUM_FIXED_MTRRS + 1;

-- 
To view, visit https://review.coreboot.org/25529
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: I8c1bbc5f4b556cdc28099e3ed439202bbd8a7f49
Gerrit-Change-Number: 25529
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/34d56b28/attachment.html>


More information about the coreboot-gerrit mailing list