summaryrefslogtreecommitdiffstats
path: root/src/cpu/x86/mp_init.c
diff options
context:
space:
mode:
authorJeremy Compostella <jeremy.compostella@intel.com>2023-05-22 17:38:10 -0700
committerMartin L Roth <gaumless@gmail.com>2023-05-31 14:22:31 +0000
commit4a2ce029fb9af7aaa33128ae0af2d4a01dfadd08 (patch)
tree1adf753382cd3648fe1b4677247c6f0ec99df876 /src/cpu/x86/mp_init.c
parentf167df4d3fbfd74b4bbf35502daf8e533a925eaf (diff)
downloadcoreboot-4a2ce029fb9af7aaa33128ae0af2d4a01dfadd08.tar.gz
coreboot-4a2ce029fb9af7aaa33128ae0af2d4a01dfadd08.tar.bz2
coreboot-4a2ce029fb9af7aaa33128ae0af2d4a01dfadd08.zip
cpu/x86/mp_init: Use clflush to write SIPI data back to RAM
Improve boot time performances by replacing the wbinvd instruction with multiple clflush to ensure that the SIPI data is written back to RAM. According to some experimental measurements, the wbinvd execution takes between 1.6 up and 6 milliseconds to complete. In the case of the SIPI data, wbinvd unnecessarily flushes and invalidates the entire cache. Indeed, the SIPI module is quite small (about 400 bytes) and cflush'ing the associated cache lines is almost instantaneous, typically less than 100 microseconds. BUG=b/260455826 TEST=Successful boot on Skolas and Rex board Change-Id: I0e00db8eaa6a3cb41bec3422572c8f2a9bec4057 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Suggested-by: Erin Park <erin.park@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75391 Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/cpu/x86/mp_init.c')
-rw-r--r--src/cpu/x86/mp_init.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index 28d6092d0da7..6809f812d75c 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -364,6 +364,13 @@ static atomic_t *load_sipi_vector(struct mp_params *mp_params)
ap_count = &sp->ap_count;
atomic_set(ap_count, 0);
+ /* Make sure SIPI data hits RAM so the APs that come up will see the
+ startup code even if the caches are disabled. */
+ if (clflush_supported())
+ clflush_region((uintptr_t)mod_loc, module_size);
+ else
+ wbinvd();
+
return ap_count;
}
@@ -626,10 +633,6 @@ static enum cb_err mp_init(struct bus *cpu_bus, struct mp_params *p)
if (ap_count == NULL)
return CB_ERR;
- /* Make sure SIPI data hits RAM so the APs that come up will see
- * the startup code even if the caches are disabled. */
- wbinvd();
-
/* Start the APs providing number of APs and the cpus_entered field. */
global_num_aps = p->num_cpus - 1;
if (start_aps(cpu_bus, global_num_aps, ap_count) != CB_SUCCESS) {