aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/x86/mp_init.c41
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c6
-rw-r--r--src/include/cpu/x86/smm.h5
3 files changed, 13 insertions, 39 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index c4e175f493..e4e662e9ad 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -673,9 +673,6 @@ struct mp_state {
int cpu_count;
uintptr_t perm_smbase;
size_t perm_smsize;
- /* Size of the real CPU save state */
- size_t smm_real_save_state_size;
- /* Size of allocated CPU save state, MAX(real save state size, stub size) */
size_t smm_save_state_size;
uintptr_t reloc_start32_offset;
int do_smm;
@@ -756,13 +753,11 @@ static void adjust_smm_apic_id_map(struct smm_loader_params *smm_params)
stub_params->apic_id_to_cpu[i] = cpu_get_apic_id(i);
}
-static enum cb_err install_relocation_handler(int num_cpus, size_t real_save_state_size,
- size_t save_state_size)
+static enum cb_err install_relocation_handler(int num_cpus, size_t save_state_size)
{
struct smm_loader_params smm_params = {
.num_cpus = num_cpus,
- .real_cpu_save_state_size = real_save_state_size,
- .per_cpu_save_state_size = save_state_size,
+ .cpu_save_state_size = save_state_size,
.num_concurrent_save_states = 1,
.handler = smm_do_relocation,
};
@@ -779,8 +774,7 @@ static enum cb_err install_relocation_handler(int num_cpus, size_t real_save_sta
}
static enum cb_err install_permanent_handler(int num_cpus, uintptr_t smbase,
- size_t smsize, size_t real_save_state_size,
- size_t save_state_size)
+ size_t smsize, size_t save_state_size)
{
/*
* All the CPUs will relocate to permanaent handler now. Set parameters
@@ -791,8 +785,7 @@ static enum cb_err install_permanent_handler(int num_cpus, uintptr_t smbase,
*/
struct smm_loader_params smm_params = {
.num_cpus = num_cpus,
- .real_cpu_save_state_size = real_save_state_size,
- .per_cpu_save_state_size = save_state_size,
+ .cpu_save_state_size = save_state_size,
.num_concurrent_save_states = num_cpus,
};
@@ -809,8 +802,7 @@ static enum cb_err install_permanent_handler(int num_cpus, uintptr_t smbase,
/* Load SMM handlers as part of MP flight record. */
static void load_smm_handlers(void)
{
- size_t real_save_state_size = mp_state.smm_real_save_state_size;
- size_t smm_save_state_size = mp_state.smm_save_state_size;
+ const size_t save_state_size = mp_state.smm_save_state_size;
/* Do nothing if SMM is disabled.*/
if (!is_smm_enabled())
@@ -823,15 +815,13 @@ static void load_smm_handlers(void)
}
/* Install handlers. */
- if (install_relocation_handler(mp_state.cpu_count, real_save_state_size,
- smm_save_state_size) != CB_SUCCESS) {
+ if (install_relocation_handler(mp_state.cpu_count, save_state_size) != CB_SUCCESS) {
printk(BIOS_ERR, "Unable to install SMM relocation handler.\n");
smm_disable();
}
if (install_permanent_handler(mp_state.cpu_count, mp_state.perm_smbase,
- mp_state.perm_smsize, real_save_state_size,
- smm_save_state_size) != CB_SUCCESS) {
+ mp_state.perm_smsize, save_state_size) != CB_SUCCESS) {
printk(BIOS_ERR, "Unable to install SMM permanent handler.\n");
smm_disable();
}
@@ -1090,26 +1080,11 @@ static struct mp_flight_record mp_steps[] = {
MP_FR_BLOCK_APS(ap_wait_for_instruction, NULL),
};
-static size_t smm_stub_size(void)
-{
- extern unsigned char _binary_smmstub_start[];
- struct rmodule smm_stub;
-
- if (rmodule_parse(&_binary_smmstub_start, &smm_stub)) {
- printk(BIOS_ERR, "%s: unable to get SMM module size\n", __func__);
- return 0;
- }
-
- return rmodule_memory_size(&smm_stub);
-}
-
static void fill_mp_state_smm(struct mp_state *state, const struct mp_ops *ops)
{
if (ops->get_smm_info != NULL)
ops->get_smm_info(&state->perm_smbase, &state->perm_smsize,
- &state->smm_real_save_state_size);
-
- state->smm_save_state_size = MAX(state->smm_real_save_state_size, smm_stub_size());
+ &state->smm_save_state_size);
/*
* Make sure there is enough room for the SMM descriptor
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index ea006e3335..6502a6d5b1 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -106,7 +106,7 @@ static int smm_create_map(const uintptr_t smbase, const unsigned int num_cpus,
* Make sure that the first stub does not overlap with the last save state of a segment.
*/
const size_t stub_size = rmodule_memory_size(&smm_stub);
- const size_t needed_ss_size = MAX(params->real_cpu_save_state_size, stub_size);
+ const size_t needed_ss_size = MAX(params->cpu_save_state_size, stub_size);
const size_t cpus_per_segment =
(SMM_CODE_SEGMENT_SIZE - SMM_ENTRY_OFFSET - stub_size) / needed_ss_size;
@@ -127,7 +127,7 @@ static int smm_create_map(const uintptr_t smbase, const unsigned int num_cpus,
cpus[i].code_start = cpus[i].smbase + SMM_ENTRY_OFFSET;
cpus[i].code_end = cpus[i].code_start + stub_size;
cpus[i].ss_top = cpus[i].smbase + SMM_CODE_SEGMENT_SIZE;
- cpus[i].ss_start = cpus[i].ss_top - params->real_cpu_save_state_size;
+ cpus[i].ss_start = cpus[i].ss_top - params->cpu_save_state_size;
printk(BIOS_DEBUG, " Stub [0x%lx-0x%lx[\n", cpus[i].code_start,
cpus[i].code_end);
printk(BIOS_DEBUG, " Save state [0x%lx-0x%lx[\n", cpus[i].ss_start,
@@ -372,7 +372,7 @@ static void setup_smihandler_params(struct smm_runtime *mod_params,
{
mod_params->smbase = smram_base;
mod_params->smm_size = smram_size;
- mod_params->save_state_size = loader_params->real_cpu_save_state_size;
+ mod_params->save_state_size = loader_params->cpu_save_state_size;
mod_params->num_cpus = loader_params->num_cpus;
mod_params->gnvs_ptr = (uint32_t)(uintptr_t)acpi_get_gnvs();
const struct cbmem_entry *cbmemc;
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index 03b9c39903..b6d778b4c9 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -127,7 +127,7 @@ static inline bool smm_points_to_smram(const void *ptr, const size_t len)
/* The smm_loader_params structure provides direction to the SMM loader:
* - num_cpus - number of concurrent cpus in handler needing stack
* optional for setting up relocation handler.
- * - per_cpu_save_state_size - the SMM save state size per cpu
+ * - cpu_save_state_size - the SMM save state size per cpu
* - num_concurrent_save_states - number of concurrent cpus needing save state
* space
* - handler - optional handler to call. Only used during SMM relocation setup.
@@ -139,8 +139,7 @@ static inline bool smm_points_to_smram(const void *ptr, const size_t len)
struct smm_loader_params {
size_t num_cpus;
- size_t real_cpu_save_state_size;
- size_t per_cpu_save_state_size;
+ size_t cpu_save_state_size;
size_t num_concurrent_save_states;
smm_handler_t handler;