From 3fa23b8c008709e4204992c52fcd5b729454b333 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 25 Jan 2021 09:42:08 +0100 Subject: soc/intel/*: Get rid of custom microcode caching Get rid of custom microcode caching in MPinit and SGX code and use the caching introduced in intel_microcode_find() instead. Change-Id: If3ccd4dcff221c88839ffeafa812f4c38cede63f Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/49897 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Angel Pons --- src/soc/intel/common/block/cpu/mp_init.c | 19 ++++--------------- .../intel/common/block/include/intelblocks/mp_init.h | 8 -------- src/soc/intel/common/block/sgx/sgx.c | 2 +- src/soc/intel/xeon_sp/cpx/cpu.c | 7 +------ 4 files changed, 6 insertions(+), 30 deletions(-) (limited to 'src/soc') diff --git a/src/soc/intel/common/block/cpu/mp_init.c b/src/soc/intel/common/block/cpu/mp_init.c index 4fd2074343..8f8cd069b3 100644 --- a/src/soc/intel/common/block/cpu/mp_init.c +++ b/src/soc/intel/common/block/cpu/mp_init.c @@ -15,8 +15,6 @@ #include #include -static const void *microcode_patch; - /* SoC override function */ __weak void soc_core_init(struct device *dev) { @@ -31,6 +29,8 @@ __weak void soc_init_cpus(struct bus *cpu_bus) static void init_one_cpu(struct device *dev) { soc_core_init(dev); + + const void *microcode_patch = intel_microcode_find(); intel_microcode_load_unlocked(microcode_patch); } @@ -104,17 +104,6 @@ int get_cpu_count(void) return num_virt_cores; } -/* - * Function to get the microcode patch pointer. Use this function to avoid - * reading the microcode patch from the boot media. init_cpus() would - * initialize microcode_patch global variable to point to microcode patch - * in boot media and this function can be used to access the pointer. - */ -const void *intel_mp_current_microcode(void) -{ - return microcode_patch; -} - /* * MP Init callback function(get_microcode_info) to find the Microcode at * Pre MP Init phase. This function is common among all SOCs and thus its in @@ -125,7 +114,7 @@ const void *intel_mp_current_microcode(void) */ void get_microcode_info(const void **microcode, int *parallel) { - *microcode = intel_mp_current_microcode(); + *microcode = intel_microcode_find(); *parallel = 1; } @@ -151,7 +140,7 @@ static void coreboot_init_cpus(void *unused) if (CONFIG(USE_INTEL_FSP_MP_INIT)) return; - microcode_patch = intel_microcode_find(); + const void *microcode_patch = intel_microcode_find(); intel_microcode_load_unlocked(microcode_patch); init_cpus(); diff --git a/src/soc/intel/common/block/include/intelblocks/mp_init.h b/src/soc/intel/common/block/include/intelblocks/mp_init.h index 7dc85df24e..9038dd5823 100644 --- a/src/soc/intel/common/block/include/intelblocks/mp_init.h +++ b/src/soc/intel/common/block/include/intelblocks/mp_init.h @@ -53,14 +53,6 @@ */ int get_cpu_count(void); -/* - * Function to get the microcode patch pointer. Use this function to avoid - * reading the microcode patch from the boot media. init_cpus() would - * initialize microcode_patch global variable to point to microcode patch - * in boot media and this function can be used to access the pointer. - */ -const void *intel_mp_current_microcode(void); - /* * MP Init callback function(get_microcode_info) to find the Microcode at * Pre MP Init phase. This function is common among all SOCs and thus its in diff --git a/src/soc/intel/common/block/sgx/sgx.c b/src/soc/intel/common/block/sgx/sgx.c index 336ed54f06..b5c8944a9b 100644 --- a/src/soc/intel/common/block/sgx/sgx.c +++ b/src/soc/intel/common/block/sgx/sgx.c @@ -224,7 +224,7 @@ void sgx_configure(void *unused) * loads and to prevent simultaneous load attempts to the same core. */ if (!intel_ht_sibling()) { - const void *microcode_patch = intel_mp_current_microcode(); + const void *microcode_patch = intel_microcode_find(); intel_microcode_load_unlocked(microcode_patch); } diff --git a/src/soc/intel/xeon_sp/cpx/cpu.c b/src/soc/intel/xeon_sp/cpx/cpu.c index 4dea1a40a6..be01fc0b9f 100644 --- a/src/soc/intel/xeon_sp/cpx/cpu.c +++ b/src/soc/intel/xeon_sp/cpx/cpu.c @@ -58,15 +58,10 @@ static void xeon_configure_mca(void) */ void get_microcode_info(const void **microcode, int *parallel) { - *microcode = intel_mp_current_microcode(); + *microcode = intel_microcode_find(); *parallel = 0; } -const void *intel_mp_current_microcode(void) -{ - return microcode_patch; -} - static void each_cpu_init(struct device *cpu) { msr_t msr; -- cgit v1.2.3