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 <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/49897 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
committed by
Patrick Georgi
parent
7aaea37e37
commit
3fa23b8c00
@@ -9,11 +9,10 @@
|
|||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
|
|
||||||
/* Parallel MP initialization support. */
|
/* Parallel MP initialization support. */
|
||||||
static const void *microcode_patch;
|
|
||||||
|
|
||||||
static void pre_mp_init(void)
|
static void pre_mp_init(void)
|
||||||
{
|
{
|
||||||
intel_microcode_load_unlocked(microcode_patch);
|
const void *patch = intel_microcode_find();
|
||||||
|
intel_microcode_load_unlocked(patch);
|
||||||
|
|
||||||
/* Setup MTRRs based on physical address size. */
|
/* Setup MTRRs based on physical address size. */
|
||||||
x86_setup_mtrrs_with_detect();
|
x86_setup_mtrrs_with_detect();
|
||||||
@@ -32,7 +31,7 @@ static int get_cpu_count(void)
|
|||||||
|
|
||||||
static void get_microcode_info(const void **microcode, int *parallel)
|
static void get_microcode_info(const void **microcode, int *parallel)
|
||||||
{
|
{
|
||||||
*microcode = microcode_patch;
|
*microcode = intel_microcode_find();
|
||||||
*parallel = !intel_ht_supported();
|
*parallel = !intel_ht_supported();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +97,6 @@ static const struct mp_ops mp_ops = {
|
|||||||
|
|
||||||
void mp_init_cpus(struct bus *cpu_bus)
|
void mp_init_cpus(struct bus *cpu_bus)
|
||||||
{
|
{
|
||||||
microcode_patch = intel_microcode_find();
|
|
||||||
|
|
||||||
if (mp_init_with_smm(cpu_bus, &mp_ops))
|
if (mp_init_with_smm(cpu_bus, &mp_ops))
|
||||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||||
}
|
}
|
||||||
|
@@ -123,8 +123,6 @@ static void model_2065x_init(struct device *cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* MP initialization support. */
|
/* MP initialization support. */
|
||||||
static const void *microcode_patch;
|
|
||||||
|
|
||||||
static void pre_mp_init(void)
|
static void pre_mp_init(void)
|
||||||
{
|
{
|
||||||
/* Setup MTRRs based on physical address size. */
|
/* Setup MTRRs based on physical address size. */
|
||||||
@@ -149,8 +147,7 @@ static int get_cpu_count(void)
|
|||||||
|
|
||||||
static void get_microcode_info(const void **microcode, int *parallel)
|
static void get_microcode_info(const void **microcode, int *parallel)
|
||||||
{
|
{
|
||||||
microcode_patch = intel_microcode_find();
|
*microcode = intel_microcode_find();
|
||||||
*microcode = microcode_patch;
|
|
||||||
*parallel = !intel_ht_supported();
|
*parallel = !intel_ht_supported();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,6 +157,7 @@ static void per_cpu_smm_trigger(void)
|
|||||||
smm_relocate();
|
smm_relocate();
|
||||||
|
|
||||||
/* After SMM relocation a 2nd microcode load is required. */
|
/* After SMM relocation a 2nd microcode load is required. */
|
||||||
|
const void *microcode_patch = intel_microcode_find();
|
||||||
intel_microcode_load_unlocked(microcode_patch);
|
intel_microcode_load_unlocked(microcode_patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -466,8 +466,6 @@ static void model_206ax_init(struct device *cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* MP initialization support. */
|
/* MP initialization support. */
|
||||||
static const void *microcode_patch;
|
|
||||||
|
|
||||||
static void pre_mp_init(void)
|
static void pre_mp_init(void)
|
||||||
{
|
{
|
||||||
/* Setup MTRRs based on physical address size. */
|
/* Setup MTRRs based on physical address size. */
|
||||||
@@ -492,8 +490,7 @@ static int get_cpu_count(void)
|
|||||||
|
|
||||||
static void get_microcode_info(const void **microcode, int *parallel)
|
static void get_microcode_info(const void **microcode, int *parallel)
|
||||||
{
|
{
|
||||||
microcode_patch = intel_microcode_find();
|
*microcode = intel_microcode_find();
|
||||||
*microcode = microcode_patch;
|
|
||||||
*parallel = !intel_ht_supported();
|
*parallel = !intel_ht_supported();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,6 +500,7 @@ static void per_cpu_smm_trigger(void)
|
|||||||
smm_relocate();
|
smm_relocate();
|
||||||
|
|
||||||
/* After SMM relocation a 2nd microcode load is required. */
|
/* After SMM relocation a 2nd microcode load is required. */
|
||||||
|
const void *microcode_patch = intel_microcode_find();
|
||||||
intel_microcode_load_unlocked(microcode_patch);
|
intel_microcode_load_unlocked(microcode_patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
#include <intelblocks/msr.h>
|
#include <intelblocks/msr.h>
|
||||||
#include <soc/cpu.h>
|
#include <soc/cpu.h>
|
||||||
|
|
||||||
static const void *microcode_patch;
|
|
||||||
|
|
||||||
/* SoC override function */
|
/* SoC override function */
|
||||||
__weak void soc_core_init(struct device *dev)
|
__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)
|
static void init_one_cpu(struct device *dev)
|
||||||
{
|
{
|
||||||
soc_core_init(dev);
|
soc_core_init(dev);
|
||||||
|
|
||||||
|
const void *microcode_patch = intel_microcode_find();
|
||||||
intel_microcode_load_unlocked(microcode_patch);
|
intel_microcode_load_unlocked(microcode_patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,17 +104,6 @@ int get_cpu_count(void)
|
|||||||
return num_virt_cores;
|
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
|
* 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
|
* 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)
|
void get_microcode_info(const void **microcode, int *parallel)
|
||||||
{
|
{
|
||||||
*microcode = intel_mp_current_microcode();
|
*microcode = intel_microcode_find();
|
||||||
*parallel = 1;
|
*parallel = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +140,7 @@ static void coreboot_init_cpus(void *unused)
|
|||||||
if (CONFIG(USE_INTEL_FSP_MP_INIT))
|
if (CONFIG(USE_INTEL_FSP_MP_INIT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
microcode_patch = intel_microcode_find();
|
const void *microcode_patch = intel_microcode_find();
|
||||||
intel_microcode_load_unlocked(microcode_patch);
|
intel_microcode_load_unlocked(microcode_patch);
|
||||||
|
|
||||||
init_cpus();
|
init_cpus();
|
||||||
|
@@ -53,14 +53,6 @@
|
|||||||
*/
|
*/
|
||||||
int get_cpu_count(void);
|
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
|
* 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
|
* Pre MP Init phase. This function is common among all SOCs and thus its in
|
||||||
|
@@ -224,7 +224,7 @@ void sgx_configure(void *unused)
|
|||||||
* loads and to prevent simultaneous load attempts to the same core.
|
* loads and to prevent simultaneous load attempts to the same core.
|
||||||
*/
|
*/
|
||||||
if (!intel_ht_sibling()) {
|
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);
|
intel_microcode_load_unlocked(microcode_patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -58,15 +58,10 @@ static void xeon_configure_mca(void)
|
|||||||
*/
|
*/
|
||||||
void get_microcode_info(const void **microcode, int *parallel)
|
void get_microcode_info(const void **microcode, int *parallel)
|
||||||
{
|
{
|
||||||
*microcode = intel_mp_current_microcode();
|
*microcode = intel_microcode_find();
|
||||||
*parallel = 0;
|
*parallel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *intel_mp_current_microcode(void)
|
|
||||||
{
|
|
||||||
return microcode_patch;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void each_cpu_init(struct device *cpu)
|
static void each_cpu_init(struct device *cpu)
|
||||||
{
|
{
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
|
Reference in New Issue
Block a user