<p>Marshall Dawson has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25530">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cpu/x86: Use calculated set of vMTRRs in ap_init<br><br>Make a generic function that loads a golden set of variable MTRRs<br>on the core.  Call from each AP in ap_init depending on the Kconfig<br>option.  This allows the BSP to take advantage of temporary MTRR<br>settings without having them incorrectly reflected to the APs.<br><br>BUG=b:77457944<br>TEST=tested using change ID I96f50af<br><br>Change-Id: I5758d867423c0bf9e77a511af9c82ee4a1ca09d9<br>Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com><br>---<br>M src/cpu/x86/mp_init.c<br>M src/cpu/x86/mtrr/mtrr.c<br>M src/include/cpu/x86/mtrr.h<br>3 files changed, 12 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/25530/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c</span><br><span>index f8dfd3d..749843d 100644</span><br><span>--- a/src/cpu/x86/mp_init.c</span><br><span>+++ b/src/cpu/x86/mp_init.c</span><br><span>@@ -223,6 +223,10 @@</span><br><span> {</span><br><span>       struct cpu_info *info;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+    /* Mirrored sets MTRRs in sipi_vector.S.  Use golden set otherwise. */</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%);">+             x86_set_final_mtrrs();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     /* Ensure the local APIC is enabled */</span><br><span>       enable_lapic();</span><br><span> </span><br><span>diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c</span><br><span>index 08312fb..aca835a 100644</span><br><span>--- a/src/cpu/x86/mtrr/mtrr.c</span><br><span>+++ b/src/cpu/x86/mtrr/mtrr.c</span><br><span>@@ -890,10 +890,15 @@</span><br><span>         memranges_teardown(&addr_space);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void x86_set_final_mtrrs(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      commit_var_mtrrs(&mtrr_global_solution);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void remove_temp_solution(void *unused)</span><br><span> {</span><br><span>     if (put_back_original_solution)</span><br><span style="color: hsl(0, 100%, 40%);">-         commit_var_mtrrs(&mtrr_global_solution);</span><br><span style="color: hsl(120, 100%, 40%);">+          x86_set_final_mtrrs();</span><br><span> }</span><br><span> </span><br><span> BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, remove_temp_solution, NULL);</span><br><span>diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h</span><br><span>index 0d64be5..4584be8 100644</span><br><span>--- a/src/include/cpu/x86/mtrr.h</span><br><span>+++ b/src/include/cpu/x86/mtrr.h</span><br><span>@@ -93,6 +93,8 @@</span><br><span>    unsigned int type);</span><br><span> int get_free_var_mtrr(void);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void x86_set_final_mtrrs(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* fms: find most significant bit set, stolen from Linux Kernel Source. */</span><br><span> static inline unsigned int fms(unsigned int x)</span><br><span> {</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25530">change 25530</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/25530"/><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: I5758d867423c0bf9e77a511af9c82ee4a1ca09d9 </div>
<div style="display:none"> Gerrit-Change-Number: 25530 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marshall Dawson <marshalldawson3rd@gmail.com> </div>