cpu/x86/smm: Add smm_size to relocatable smmstub
To mitigate against sinkhole in software which is required on
pre-sandybridge hardware, the smm entry point needs to check if the
LAPIC base is between smbase and smbase + smmsize. The size needs to
be available early so add them to the relocatable module parameters.
When the smmstub is used to relocate SMM the default SMM size 0x10000
is provided. On the permanent handler the size provided by
get_smm_info() is used.
Original-Change-Id: I0df6e51bcba284350f1c849ef3d012860757544b
Original-Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Original-Reviewed-on: https://review.coreboot.org/c/coreboot/+/37288
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Patrick Georgi <pgeorgi@google.com>
(cherry picked from commit a3eb3df01c
)
Signed-off-by: Marc Jones <marcjones@sysproconsulting.com>
Change-Id: I4948639a513b196382eb38616fe872b72bb7e59e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50310
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Jay Talbott <JayTalbott@sysproconsulting.com>
This commit is contained in:
parent
c7af5ef509
commit
fc8a6fa93a
|
@ -174,8 +174,9 @@ static void smm_stub_place_staggered_entry_points(char *base,
|
||||||
* concurrent areas requested. The save state always lives at the top of SMRAM
|
* concurrent areas requested. The save state always lives at the top of SMRAM
|
||||||
* space, and the entry point is at offset 0x8000.
|
* space, and the entry point is at offset 0x8000.
|
||||||
*/
|
*/
|
||||||
static int smm_module_setup_stub(void *smbase, struct smm_loader_params *params,
|
static int smm_module_setup_stub(void *smbase, size_t smm_size,
|
||||||
void *fxsave_area)
|
struct smm_loader_params *params,
|
||||||
|
void *fxsave_area)
|
||||||
{
|
{
|
||||||
size_t total_save_state_size;
|
size_t total_save_state_size;
|
||||||
size_t smm_stub_size;
|
size_t smm_stub_size;
|
||||||
|
@ -267,6 +268,7 @@ static int smm_module_setup_stub(void *smbase, struct smm_loader_params *params,
|
||||||
stub_params->fxsave_area = (uintptr_t)fxsave_area;
|
stub_params->fxsave_area = (uintptr_t)fxsave_area;
|
||||||
stub_params->fxsave_area_size = FXSAVE_SIZE;
|
stub_params->fxsave_area_size = FXSAVE_SIZE;
|
||||||
stub_params->runtime.smbase = (uintptr_t)smbase;
|
stub_params->runtime.smbase = (uintptr_t)smbase;
|
||||||
|
stub_params->runtime.smm_size = smm_size;
|
||||||
stub_params->runtime.save_state_size = params->per_cpu_save_state_size;
|
stub_params->runtime.save_state_size = params->per_cpu_save_state_size;
|
||||||
stub_params->runtime.num_cpus = params->num_concurrent_stacks;
|
stub_params->runtime.num_cpus = params->num_concurrent_stacks;
|
||||||
|
|
||||||
|
@ -307,7 +309,8 @@ int smm_setup_relocation_handler(struct smm_loader_params *params)
|
||||||
if (params->num_concurrent_stacks == 0)
|
if (params->num_concurrent_stacks == 0)
|
||||||
params->num_concurrent_stacks = CONFIG_MAX_CPUS;
|
params->num_concurrent_stacks = CONFIG_MAX_CPUS;
|
||||||
|
|
||||||
return smm_module_setup_stub(smram, params, fxsave_area_relocation);
|
return smm_module_setup_stub(smram, SMM_DEFAULT_SIZE,
|
||||||
|
params, fxsave_area_relocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The SMM module is placed within the provided region in the following
|
/* The SMM module is placed within the provided region in the following
|
||||||
|
@ -408,5 +411,5 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params)
|
||||||
params->handler = rmodule_entry(&smm_mod);
|
params->handler = rmodule_entry(&smm_mod);
|
||||||
params->handler_arg = rmodule_parameters(&smm_mod);
|
params->handler_arg = rmodule_parameters(&smm_mod);
|
||||||
|
|
||||||
return smm_module_setup_stub(smram, params, fxsave_area);
|
return smm_module_setup_stub(smram, size, params, fxsave_area);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ fxsave_area_size:
|
||||||
smm_runtime:
|
smm_runtime:
|
||||||
smbase:
|
smbase:
|
||||||
.long 0
|
.long 0
|
||||||
|
smm_size:
|
||||||
|
.long 0
|
||||||
save_state_size:
|
save_state_size:
|
||||||
.long 0
|
.long 0
|
||||||
num_cpus:
|
num_cpus:
|
||||||
|
|
|
@ -63,6 +63,7 @@ extern unsigned char _binary_smm_end[];
|
||||||
|
|
||||||
struct smm_runtime {
|
struct smm_runtime {
|
||||||
u32 smbase;
|
u32 smbase;
|
||||||
|
u32 smm_size;
|
||||||
u32 save_state_size;
|
u32 save_state_size;
|
||||||
u32 num_cpus;
|
u32 num_cpus;
|
||||||
/* STM's 32bit entry into SMI handler */
|
/* STM's 32bit entry into SMI handler */
|
||||||
|
|
Loading…
Reference in New Issue