<p>Marshall Dawson has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25529">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cpu/x86: Add Kconfig for mirroring BSP MTRRs<br><br>All systems using the standard mp_init currently mirror the BSP's<br>variable MTRRs to each AP that is initialilized.  This is the first<br>of a series of patches that will convert ap_init to use a golden set<br>of calculated set of ranges instead.<br><br>Some implementations intend for the settings to be mirrored, so create<br>an option that will be used later only for those exceptions.  In the<br>mp_init function, check the option.<br><br>This first patch should have no functional effect on any system.<br><br>BUG=b:77457944<br>TEST=Run AMD Padmelon and observe no changes in MTRRs<br><br>Change-Id: I8c1bbc5f4b556cdc28099e3ed439202bbd8a7f49<br>Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com><br>---<br>M src/cpu/x86/Kconfig<br>M src/cpu/x86/mp_init.c<br>2 files changed, 15 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/25529/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig</span><br><span>index a20febb..679505b 100644</span><br><span>--- a/src/cpu/x86/Kconfig</span><br><span>+++ b/src/cpu/x86/Kconfig</span><br><span>@@ -137,6 +137,16 @@</span><br><span>           This option informs the MTRR code to use the RdMem and WrMem fields</span><br><span>          in the fixed MTRR MSRs.</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+config X86_AP_VMTRRS_MIRROR_BSP</span><br><span style="color: hsl(120, 100%, 40%);">+        bool</span><br><span style="color: hsl(120, 100%, 40%);">+  default y</span><br><span style="color: hsl(120, 100%, 40%);">+     help</span><br><span style="color: hsl(120, 100%, 40%);">+    Certain implementations may enter the common multi-processor</span><br><span style="color: hsl(120, 100%, 40%);">+          initialization with the variable MTRRs already programmed, but</span><br><span style="color: hsl(120, 100%, 40%);">+        others may elect to set them in the function member .pre_mp_init.</span><br><span style="color: hsl(120, 100%, 40%);">+     This option allows the AP setup feature to exactly mirror the</span><br><span style="color: hsl(120, 100%, 40%);">+         BSP's MTRR settings.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> config PLATFORM_USES_FSP1_0</span><br><span>  bool</span><br><span>         default n</span><br><span>diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c</span><br><span>index f99abaf..f8dfd3d 100644</span><br><span>--- a/src/cpu/x86/mp_init.c</span><br><span>+++ b/src/cpu/x86/mp_init.c</span><br><span>@@ -288,8 +288,11 @@</span><br><span>    msr_t msr;</span><br><span> </span><br><span>       /* Determine number of MTRRs need to be saved. */</span><br><span style="color: hsl(0, 100%, 40%);">-       msr = rdmsr(MTRR_CAP_MSR);</span><br><span style="color: hsl(0, 100%, 40%);">-      num_var_mtrrs = msr.lo & 0xff;</span><br><span style="color: hsl(120, 100%, 40%);">+    num_var_mtrrs = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+    if (IS_ENABLED(CONFIG_X86_AP_VMTRRS_MIRROR_BSP)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            msr = rdmsr(MTRR_CAP_MSR);</span><br><span style="color: hsl(120, 100%, 40%);">+            num_var_mtrrs = msr.lo & 0xff;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span> </span><br><span>        /* 2 * num_var_mtrrs for base and mask. +1 for IA32_MTRR_DEF_TYPE. */</span><br><span>        msr_count = 2 * num_var_mtrrs + NUM_FIXED_MTRRS + 1;</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25529">change 25529</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/25529"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8c1bbc5f4b556cdc28099e3ed439202bbd8a7f49 </div>
<div style="display:none"> Gerrit-Change-Number: 25529 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marshall Dawson <marshalldawson3rd@gmail.com> </div>