[coreboot-gerrit] Change in coreboot[master]: [WIP]nb/intel/gm45: Use parallel MP init

Arthur Heymans (Code Review) gerrit at coreboot.org
Thu Jan 25 21:47:40 CET 2018


Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/23434


Change subject: [WIP]nb/intel/gm45: Use parallel MP init
......................................................................

[WIP]nb/intel/gm45: Use parallel MP init

This pertains to CPUs but mix and match of CPU/NB/SB (code) make this a
little hard to get right for all targets. It needs a good cleanup...

Change-Id: Iac416f671407246ee223075eee1aff511e612889
Signed-off-by: Arthur Heymans <arthur at aheymans.xyz>
---
M src/cpu/intel/model_1067x/model_1067x_init.c
M src/northbridge/intel/gm45/Kconfig
M src/northbridge/intel/gm45/northbridge.c
3 files changed, 58 insertions(+), 10 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/23434/1

diff --git a/src/cpu/intel/model_1067x/model_1067x_init.c b/src/cpu/intel/model_1067x/model_1067x_init.c
index 0d9169b..148ca45 100644
--- a/src/cpu/intel/model_1067x/model_1067x_init.c
+++ b/src/cpu/intel/model_1067x/model_1067x_init.c
@@ -21,12 +21,14 @@
 #include <cpu/cpu.h>
 #include <cpu/x86/mtrr.h>
 #include <cpu/x86/msr.h>
+#include <cpu/x86/mp.h>
 #include <cpu/x86/lapic.h>
 #include <cpu/intel/microcode.h>
 #include <cpu/intel/speedstep.h>
 #include <cpu/intel/hyperthreading.h>
 #include <cpu/x86/cache.h>
 #include <cpu/x86/name.h>
+#include <cpu/intel/smm/gen1/smi.h>
 #include <cpu/intel/common/common.h>
 #include "chip.h"
 
@@ -278,17 +280,10 @@
 	/* Turn on caching if we haven't already */
 	x86_enable_cache();
 
-	/* Update the microcode */
-	intel_update_microcode_from_cbfs();
-
 	/* Print processor name */
 	fill_processor_name(processor_name);
 	printk(BIOS_INFO, "CPU: %s.\n", processor_name);
 
-	/* Setup MTRRs */
-	x86_setup_mtrrs();
-	x86_mtrr_check();
-
 	/* Enable the local CPU APICs */
 	setup_lapic();
 
@@ -313,9 +308,61 @@
 
 	/* PIC thermal sensor control */
 	configure_pic_thermal_sensors(tm2, quad);
+}
 
-	/* Start up my CPU siblings */
-	intel_sibling_init(cpu);
+/* MP initialization support. */
+static const void *microcode_patch;
+
+static void pre_mp_init(void)
+{
+	/* Setup MTRRs based on physical address size. */
+	x86_setup_mtrrs_with_detect();
+	x86_mtrr_check();
+}
+
+static int get_cpu_count(void)
+{
+	const struct cpuid_result cpuid1 = cpuid(1);
+	const char cores = (cpuid1.ebx >> 16) & 0xf;
+
+	printk(BIOS_DEBUG, "CPU has %u cores.\n", cores);
+
+	return cores;
+}
+
+static void per_cpu_smm_trigger(void)
+{
+	/* Relocate the SMM handler. */
+	smm_relocate();
+
+	/* After SMM relocation a 2nd microcode load is required. */
+	intel_microcode_load_unlocked(microcode_patch);
+}
+
+static void post_mp_init(void)
+{
+	/* Now that all APs have been relocated as well as the BSP let SMIs
+	 * start flowing. */
+	southbridge_smm_init();
+
+	/* Lock down the SMRAM space. */
+	smm_lock();
+}
+
+static const struct mp_ops mp_ops = {
+	.pre_mp_init = pre_mp_init,
+	.get_cpu_count = get_cpu_count,
+	.get_smm_info = smm_info,
+	.pre_mp_smm_init = smm_initialize,
+	.per_cpu_smm_trigger = per_cpu_smm_trigger,
+	.relocation_handler = smm_relocation_handler,
+	.post_mp_init = post_mp_init,
+};
+
+void bsp_init_and_start_aps(struct bus *cpu_bus)
+{
+	if (mp_init_with_smm(cpu_bus, &mp_ops))
+		printk(BIOS_ERR, "MP initialization failure.\n");
 }
 
 static struct device_operations cpu_dev_ops = {
diff --git a/src/northbridge/intel/gm45/Kconfig b/src/northbridge/intel/gm45/Kconfig
index cd41371..34f23d4 100644
--- a/src/northbridge/intel/gm45/Kconfig
+++ b/src/northbridge/intel/gm45/Kconfig
@@ -30,6 +30,7 @@
 	select HAVE_LINEAR_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT
 	select HAVE_VGA_TEXT_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT
 	select SMM_TSEG
+	select PARALLEL_MP
 
 config CBFS_SIZE
 	hex
diff --git a/src/northbridge/intel/gm45/northbridge.c b/src/northbridge/intel/gm45/northbridge.c
index a6a5775..f3c8564 100644
--- a/src/northbridge/intel/gm45/northbridge.c
+++ b/src/northbridge/intel/gm45/northbridge.c
@@ -244,7 +244,7 @@
 
 static void cpu_bus_init(device_t dev)
 {
-	initialize_cpus(dev->link_list);
+	bsp_init_and_start_aps(dev->link_list);
 }
 
 static struct device_operations cpu_bus_ops = {

-- 
To view, visit https://review.coreboot.org/23434
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: Iac416f671407246ee223075eee1aff511e612889
Gerrit-Change-Number: 23434
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur at aheymans.xyz>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180125/d6a41879/attachment-0001.html>


More information about the coreboot-gerrit mailing list