Marshall Dawson has posted comments on this change. ( https://review.coreboot.org/25530 )
Change subject: cpu/x86: Use calculated set of vMTRRs in ap_init
......................................................................
Patch Set 1:
squash this with the last one?
--
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: comment
Gerrit-Change-Id: I5758d867423c0bf9e77a511af9c82ee4a1ca09d9
Gerrit-Change-Number: 25530
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Comment-Date: Wed, 04 Apr 2018 21:02:58 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No
Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/25531
Change subject: cpu/x86: Change Kconfig default for MTRR mirroring
......................................................................
cpu/x86: Change Kconfig default for MTRR mirroring
Change the Kconfig default so that systems will set AP var. MTRRs to
pre-calculated settings, not necessarily the current settings of the
BSP.
Select the Kconfig symbol for Intel platforms that rely on the FSP to
program the MTRRs, and intentionally mirror the MTRRs.
BUG=b:77457944
TEST=Run AMD Padmelon and note var. MTRRs in sync in all CUs
Change-Id: I96f50af0589f7f046d3c56962d48e6a01eba5e8e
Signed-off-by: Marshall Dawson <marshalldawson3rd(a)gmail.com>
---
M src/cpu/x86/Kconfig
M src/soc/intel/common/block/cpu/Kconfig
2 files changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/25531/1
diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig
index 679505b..bc50e02 100644
--- a/src/cpu/x86/Kconfig
+++ b/src/cpu/x86/Kconfig
@@ -139,13 +139,14 @@
config X86_AP_VMTRRS_MIRROR_BSP
bool
- default y
+ default n
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.
+ BSP's MTRR settings. The default is to use calculated settings,
+ allowing temp ranges to be used during POST.
config PLATFORM_USES_FSP1_0
bool
diff --git a/src/soc/intel/common/block/cpu/Kconfig b/src/soc/intel/common/block/cpu/Kconfig
index 48f3f16..6ec8967 100644
--- a/src/soc/intel/common/block/cpu/Kconfig
+++ b/src/soc/intel/common/block/cpu/Kconfig
@@ -10,6 +10,7 @@
config SOC_INTEL_COMMON_BLOCK_CPU_MPINIT
bool
default n
+ select X86_AP_VMTRRS_MIRROR_BSP
help
This option selects Intel Common CPU MP Init code. In
this common MP Init mechanism, the MP Init is occurring before
--
To view, visit https://review.coreboot.org/25531
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: I96f50af0589f7f046d3c56962d48e6a01eba5e8e
Gerrit-Change-Number: 25531
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd(a)gmail.com>
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(a)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(a)gmail.com>
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(a)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(a)gmail.com>