cpu/x86/smm_module_load: Fix SMM stub params

There is NULL dereference in adjust_apic_id_map() and updating
apic_id_to_cpu[] array within SMM stub fails.

Initial apic_id_to_cpu[] array may have worked for platforms
where APIC IDs are consecutive.

Change-Id: Ie59a731bfc883f8a47048b2ceacc66f44aa5b68c
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64798
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Uwe Poeche <uwe.poeche@siemens.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Kyösti Mälkki 2022-05-30 13:49:20 +03:00 committed by Arthur Heymans
parent 74129e5141
commit 2a13a5487f
1 changed files with 2 additions and 0 deletions

View File

@ -318,6 +318,8 @@ static int smm_module_setup_stub(const uintptr_t smbase, const size_t smm_size,
for (int i = 0; i < params->num_cpus; i++) for (int i = 0; i < params->num_cpus; i++)
stub_params->apic_id_to_cpu[i] = i; stub_params->apic_id_to_cpu[i] = i;
/* Allow the initiator to manipulate SMM stub parameters. */
params->stub_params = stub_params;
printk(BIOS_DEBUG, "%s: stack_top = 0x%x\n", __func__, stub_params->stack_top); printk(BIOS_DEBUG, "%s: stack_top = 0x%x\n", __func__, stub_params->stack_top);
printk(BIOS_DEBUG, "%s: per cpu stack_size = 0x%x\n", __func__, printk(BIOS_DEBUG, "%s: per cpu stack_size = 0x%x\n", __func__,