cpu/smm_module_loader.c: Fix up CPU index locally
Don't pass the stub params to the mp_init code. Change-Id: I070bc00ae5e5bceb6c5b90ea833cc057dd41f6cc Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64802 Reviewed-by: Patrick Rudolph <siro@das-labor.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
71bc9f0eba
commit
a804f9195e
|
@ -744,16 +744,6 @@ static asmlinkage void smm_do_relocation(void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adjust_smm_apic_id_map(struct smm_loader_params *smm_params)
|
|
||||||
{
|
|
||||||
struct smm_stub_params *stub_params = smm_params->stub_params;
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for (struct device *dev = g_cpu_bus->children; dev; dev = dev->sibling)
|
|
||||||
if (dev->enabled)
|
|
||||||
stub_params->apic_id_to_cpu[i++] = dev->path.apic.initial_lapicid;
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum cb_err install_relocation_handler(int num_cpus, size_t save_state_size)
|
static enum cb_err install_relocation_handler(int num_cpus, size_t save_state_size)
|
||||||
{
|
{
|
||||||
if (CONFIG(X86_SMM_SKIP_RELOCATION_HANDLER))
|
if (CONFIG(X86_SMM_SKIP_RELOCATION_HANDLER))
|
||||||
|
@ -770,7 +760,6 @@ static enum cb_err install_relocation_handler(int num_cpus, size_t save_state_si
|
||||||
printk(BIOS_ERR, "%s: smm setup failed\n", __func__);
|
printk(BIOS_ERR, "%s: smm setup failed\n", __func__);
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
}
|
}
|
||||||
adjust_smm_apic_id_map(&smm_params);
|
|
||||||
|
|
||||||
return CB_SUCCESS;
|
return CB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -796,8 +785,6 @@ static enum cb_err install_permanent_handler(int num_cpus, uintptr_t smbase,
|
||||||
if (smm_load_module(smbase, smsize, &smm_params))
|
if (smm_load_module(smbase, smsize, &smm_params))
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
|
|
||||||
adjust_smm_apic_id_map(&smm_params);
|
|
||||||
|
|
||||||
return CB_SUCCESS;
|
return CB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
#include <commonlib/helpers.h>
|
#include <commonlib/helpers.h>
|
||||||
#include <commonlib/region.h>
|
#include <commonlib/region.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
#include <cpu/cpu.h>
|
||||||
#include <cpu/x86/smm.h>
|
#include <cpu/x86/smm.h>
|
||||||
|
#include <device/device.h>
|
||||||
#include <rmodule.h>
|
#include <rmodule.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -267,12 +269,21 @@ static int smm_module_setup_stub(const uintptr_t smbase, const size_t smm_size,
|
||||||
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;
|
||||||
|
|
||||||
/* Initialize the APIC id to CPU number table to be 1:1 */
|
/* This runs on the BSP. All the APs are its siblings */
|
||||||
for (int i = 0; i < params->num_cpus; i++)
|
struct cpu_info *info = cpu_info();
|
||||||
stub_params->apic_id_to_cpu[i] = i;
|
if (!info || !info->cpu) {
|
||||||
|
printk(BIOS_ERR, "%s: Failed to find BSP struct device\n", __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
for (struct device *dev = info->cpu; dev; dev = dev->sibling)
|
||||||
|
if (dev->enabled)
|
||||||
|
stub_params->apic_id_to_cpu[i++] = dev->path.apic.initial_lapicid;
|
||||||
|
|
||||||
/* Allow the initiator to manipulate SMM stub parameters. */
|
if (i != params->num_cpus) {
|
||||||
params->stub_params = stub_params;
|
printk(BIOS_ERR, "%s: Failed to set up apic map correctly\n", __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
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__,
|
||||||
|
|
|
@ -156,8 +156,6 @@ struct smm_loader_params {
|
||||||
size_t num_concurrent_save_states;
|
size_t num_concurrent_save_states;
|
||||||
|
|
||||||
smm_handler_t handler;
|
smm_handler_t handler;
|
||||||
|
|
||||||
struct smm_stub_params *stub_params;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* All of these return 0 on success, < 0 on failure. */
|
/* All of these return 0 on success, < 0 on failure. */
|
||||||
|
|
Loading…
Reference in New Issue