summaryrefslogtreecommitdiff
path: root/src/cpu/x86/mp_init.c
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-04-07 21:50:16 +0200
committerMartin L Roth <gaumless@tutanota.com>2022-05-28 05:09:56 +0000
commit1684b0aa6752af770328c48b3adafa5e6cb386fe (patch)
tree9f6c797f14c9aade5e075efcb8e8a1979dd3b21c /src/cpu/x86/mp_init.c
parentd7c371619a287a3a74e23fc3fcff4793a12deba6 (diff)
cpu/x86/mp_init.c: Drop 'real' vs 'used' save state
Now that the save state size is handled properly inside the smm_loader there is no reason to make that distinction in the mp_init code anymore. Change-Id: Ia0002a33b6d0f792d8d78cf625fd7e830e3e50fc Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63479 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
Diffstat (limited to 'src/cpu/x86/mp_init.c')
-rw-r--r--src/cpu/x86/mp_init.c41
1 files changed, 8 insertions, 33 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