summaryrefslogtreecommitdiffstats
path: root/src/include/cpu
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-10-28 15:14:18 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-02-07 13:46:13 +0000
commit96451a7c6d66d0b9a6f7ce5e9bf01371cac55a2b (patch)
treec802c7f63601924ad4bee9e39dd53611b9fce22f /src/include/cpu
parent0eef54b8be1329e273413486f0eb764ea007a14d (diff)
downloadcoreboot-96451a7c6d66d0b9a6f7ce5e9bf01371cac55a2b.tar.gz
coreboot-96451a7c6d66d0b9a6f7ce5e9bf01371cac55a2b.tar.bz2
coreboot-96451a7c6d66d0b9a6f7ce5e9bf01371cac55a2b.zip
cpu/x86/smm: Improve smm stack setup
Both the relocation handler and the permanent handler use the same stacks, so things can be simplified. Change-Id: I7bdca775550e8280757a6c5a5150a0d638d5fc2d Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58698 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/include/cpu')
-rw-r--r--src/include/cpu/x86/mp.h21
-rw-r--r--src/include/cpu/x86/smm.h11
2 files changed, 8 insertions, 24 deletions
diff --git a/src/include/cpu/x86/mp.h b/src/include/cpu/x86/mp.h
index 934d217b78ce..1b4c956b59bc 100644
--- a/src/include/cpu/x86/mp.h
+++ b/src/include/cpu/x86/mp.h
@@ -45,17 +45,6 @@ struct mp_ops {
*/
void (*get_microcode_info)(const void **microcode, int *parallel);
/*
- * Optionally adjust SMM handler parameters to override the default
- * values. The is_perm variable indicates if the parameters to adjust
- * are for the relocation handler or the permanent handler. This
- * function is therefore called twice -- once for each handler.
- * By default the parameters for each SMM handler are:
- * stack_size num_concurrent_stacks num_concurrent_save_states
- * relo: save_state_size get_cpu_count() 1
- * perm: save_state_size get_cpu_count() get_cpu_count()
- */
- void (*adjust_smm_params)(struct smm_loader_params *slp, int is_perm);
- /*
* Optionally provide a callback prior to the APs starting SMM
* relocation or CPU driver initialization. However, note that
* this callback is called after SMM handlers have been loaded.
@@ -92,13 +81,11 @@ struct mp_ops {
* 3. get_smm_info()
* 4. get_microcode_info()
* 5. adjust_cpu_apic_entry() for each number of get_cpu_count()
- * 6. adjust_smm_params(is_perm = 0)
- * 7. adjust_smm_params(is_perm = 1)
- * 8. pre_mp_smm_init()
- * 9. per_cpu_smm_trigger() in parallel for all cpus which calls
+ * 6. pre_mp_smm_init()
+ * 7. per_cpu_smm_trigger() in parallel for all cpus which calls
* relocation_handler() in SMM.
- * 10. mp_initialize_cpu() for each cpu
- * 11. post_mp_init()
+ * 8. mp_initialize_cpu() for each cpu
+ * 9. post_mp_init()
*/
enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops);
diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h
index 848996f845f9..37247ece4919 100644
--- a/src/include/cpu/x86/smm.h
+++ b/src/include/cpu/x86/smm.h
@@ -120,9 +120,6 @@ static inline bool smm_points_to_smram(const void *ptr, const size_t len)
/* SMM Module Loading API */
/* The smm_loader_params structure provides direction to the SMM loader:
- * - stack_top - optional external stack provided to loader. It must be at
- * least per_cpu_stack_size * num_concurrent_stacks in size.
- * - per_cpu_stack_size - stack size per CPU for smm modules.
* - num_concurrent_stacks - 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
@@ -135,8 +132,6 @@ static inline bool smm_points_to_smram(const void *ptr, const size_t len)
* handle sparse APIC id space.
*/
struct smm_loader_params {
- uintptr_t stack_top;
- size_t per_cpu_stack_size;
size_t num_concurrent_stacks;
size_t real_cpu_save_state_size;
@@ -148,8 +143,10 @@ struct smm_loader_params {
struct smm_stub_params *stub_params;
};
-/* Both of these return 0 on success, < 0 on failure. */
-int smm_setup_relocation_handler(const uintptr_t perm_smram, struct smm_loader_params *params);
+/* All of these return 0 on success, < 0 on failure. */
+int smm_setup_stack(const uintptr_t perm_smbase, const size_t perm_smram_size,
+ const unsigned int total_cpus, const size_t stack_size);
+int smm_setup_relocation_handler(struct smm_loader_params *params);
int smm_load_module(uintptr_t smram_base, size_t smram_size, struct smm_loader_params *params);
u32 smm_get_cpu_smbase(unsigned int cpu_num);