From ea1a722d2b00bf9ba7fec23208fd43b8924138f9 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Sat, 24 Jan 2026 09:56:08 +0100 Subject: [PATCH] soc/intel/xeon_sp: Move microcode loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move loading of microcode to pre_mp_init() as found on other Intel CPU drivers. There’s no need to cache the microcode location since intel_microcode_find() already caches it. No function change, thus untested. Change-Id: I05bbb074d189594027916c6a3b04270bd3b6edd1 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/90892 Reviewed-by: Jérémy Compostella Reviewed-by: Sean Rhodes Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/soc/intel/xeon_sp/cpx/cpu.c | 12 +++--------- src/soc/intel/xeon_sp/gnr/cpu.c | 8 +++----- src/soc/intel/xeon_sp/skx/cpu.c | 10 +++------- src/soc/intel/xeon_sp/spr/cpu.c | 8 +++----- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/soc/intel/xeon_sp/cpx/cpu.c b/src/soc/intel/xeon_sp/cpx/cpu.c index 5df399a61b..c6375ecfdb 100644 --- a/src/soc/intel/xeon_sp/cpx/cpu.c +++ b/src/soc/intel/xeon_sp/cpx/cpu.c @@ -25,8 +25,6 @@ #include "chip.h" -static const void *microcode_patch; - static const config_t *chip_config = NULL; bool cpu_soc_is_in_untrusted_mode(void) @@ -167,6 +165,9 @@ static void set_max_turbo_freq(void) */ static void pre_mp_init(void) { + const void *microcode_patch = intel_microcode_find(); + intel_microcode_load_unlocked(microcode_patch); + x86_setup_mtrrs_with_detect(); x86_mtrr_check(); } @@ -195,13 +196,6 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *bus) { - microcode_patch = intel_microcode_find(); - - if (!microcode_patch) - printk(BIOS_ERR, "microcode not found in CBFS!\n"); - - intel_microcode_load_unlocked(microcode_patch); - /* TODO: Handle mp_init_with_smm failure? */ mp_init_with_smm(bus, &mp_ops); diff --git a/src/soc/intel/xeon_sp/gnr/cpu.c b/src/soc/intel/xeon_sp/gnr/cpu.c index 44f466d2e5..2e645a53d7 100644 --- a/src/soc/intel/xeon_sp/gnr/cpu.c +++ b/src/soc/intel/xeon_sp/gnr/cpu.c @@ -13,8 +13,6 @@ #include "chip.h" -static const void *microcode_patch; - static const config_t *chip_config = NULL; bool cpu_soc_is_in_untrusted_mode(void) @@ -59,6 +57,9 @@ static const struct cpu_driver driver __cpu_driver = { */ static void pre_mp_init(void) { + const void *microcode_patch = intel_microcode_find(); + intel_microcode_load_unlocked(microcode_patch); + x86_setup_mtrrs_with_detect(); x86_mtrr_check(); } @@ -89,9 +90,6 @@ void mp_init_cpus(struct bus *bus) */ chip_config = bus->dev->chip_info; - microcode_patch = intel_microcode_find(); - intel_microcode_load_unlocked(microcode_patch); - enum cb_err ret = mp_init_with_smm(bus, &mp_ops); if (ret != CB_SUCCESS) printk(BIOS_ERR, "MP initialization failure %d.\n", ret); diff --git a/src/soc/intel/xeon_sp/skx/cpu.c b/src/soc/intel/xeon_sp/skx/cpu.c index e829aa988c..48054baada 100644 --- a/src/soc/intel/xeon_sp/skx/cpu.c +++ b/src/soc/intel/xeon_sp/skx/cpu.c @@ -246,6 +246,9 @@ static void pre_mp_init(void) { printk(BIOS_DEBUG, "%s: entry\n", __func__); + const void *microcode_patch = intel_microcode_find(); + intel_microcode_load_unlocked(microcode_patch); + x86_setup_mtrrs_with_detect(); x86_mtrr_check(); } @@ -279,13 +282,6 @@ void mp_init_cpus(struct bus *bus) { FUNC_ENTER(); - const void *microcode_patch = intel_microcode_find(); - - if (!microcode_patch) - printk(BIOS_ERR, "microcode not found in CBFS!\n"); - - intel_microcode_load_unlocked(microcode_patch); - /* * This gets used in cpu device callback. Other than cpu 0, * rest of the CPU devices do not have diff --git a/src/soc/intel/xeon_sp/spr/cpu.c b/src/soc/intel/xeon_sp/spr/cpu.c index cafdc37970..feaac904a2 100644 --- a/src/soc/intel/xeon_sp/spr/cpu.c +++ b/src/soc/intel/xeon_sp/spr/cpu.c @@ -17,8 +17,6 @@ #include "chip.h" -static const void *microcode_patch; - static const config_t *chip_config = NULL; bool cpu_soc_is_in_untrusted_mode(void) @@ -219,6 +217,9 @@ static void set_max_turbo_freq(void) */ static void pre_mp_init(void) { + const void *microcode_patch = intel_microcode_find(); + intel_microcode_load_unlocked(microcode_patch); + x86_setup_mtrrs_with_detect(); x86_mtrr_check(); } @@ -255,9 +256,6 @@ void mp_init_cpus(struct bus *bus) */ chip_config = bus->dev->chip_info; - microcode_patch = intel_microcode_find(); - intel_microcode_load_unlocked(microcode_patch); - enum cb_err ret = mp_init_with_smm(bus, &mp_ops); if (ret != CB_SUCCESS) printk(BIOS_ERR, "MP initialization failure %d.\n", ret);