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@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;