soc/intel: Use common codeflow for MP init

This fixes MP init on xeon_sp SoCs which was broken by 69cd729 (mb/*:
Remove lapic from devicetree).

Alderlake cpu code was linked in romstage but unused so drop it.

Change-Id: Ia822468a6f15565b97e57612a294a0b80b45b932
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72604
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
This commit is contained in:
Arthur Heymans 2023-01-30 19:09:34 +01:00
parent 6b2b8355b3
commit 829e8e65b9
17 changed files with 19 additions and 52 deletions

View File

@ -22,7 +22,6 @@ romstage-y += espi.c
romstage-y += meminit.c romstage-y += meminit.c
romstage-y += pcie_rp.c romstage-y += pcie_rp.c
romstage-y += reset.c romstage-y += reset.c
romstage-y += cpu.c
ramstage-y += acpi.c ramstage-y += acpi.c
ramstage-y += chip.c ramstage-y += chip.c

View File

@ -188,7 +188,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(cpu_bus, &mp_ops); mp_init_with_smm(cpu_bus, &mp_ops);

View File

@ -209,7 +209,7 @@ static struct device_operations pci_domain_ops = {
struct device_operations apl_cpu_bus_ops = { struct device_operations apl_cpu_bus_ops = {
.read_resources = noop_read_resources, .read_resources = noop_read_resources,
.set_resources = noop_set_resources, .set_resources = noop_set_resources,
.init = apollolake_init_cpus, .init = mp_cpu_bus_init,
.acpi_fill_ssdt = generate_cpu_entries, .acpi_fill_ssdt = generate_cpu_entries,
}; };

View File

@ -262,18 +262,11 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
/* Clear for take-off */ /* Clear for take-off */
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(cpu_bus, &mp_ops); mp_init_with_smm(cpu_bus, &mp_ops);
}
void apollolake_init_cpus(struct device *dev)
{
if (!dev->link_list)
add_more_links(dev, 1);
soc_init_cpus(dev->link_list);
/* Temporarily cache the memory-mapped boot media. */ /* Temporarily cache the memory-mapped boot media. */
if (CONFIG(BOOT_DEVICE_MEMORY_MAPPED) && if (CONFIG(BOOT_DEVICE_MEMORY_MAPPED) &&

View File

@ -8,7 +8,6 @@
#include <soc/msr.h> #include <soc/msr.h>
struct device; struct device;
void apollolake_init_cpus(struct device *dev);
void mainboard_devtree_update(struct device *dev); void mainboard_devtree_update(struct device *dev);
/* Flush L1D to L2 */ /* Flush L1D to L2 */

View File

@ -203,7 +203,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(cpu_bus, &mp_ops); mp_init_with_smm(cpu_bus, &mp_ops);

View File

@ -135,16 +135,12 @@ void get_microcode_info(const void **microcode, int *parallel)
* creation of the new node will be skipped. This node will have the APIC ID defined * creation of the new node will be skipped. This node will have the APIC ID defined
* in devicetree. * in devicetree.
*/ */
void init_cpus(void) static void init_cpus(void)
{ {
struct device *dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER); struct device *dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER);
assert(dev != NULL); assert(dev != NULL);
/* In case link to APIC device is not found, create the one */ mp_cpu_bus_init(dev);
if (!dev->link_list)
add_more_links(dev, 1);
soc_init_cpus(dev->link_list);
} }
static void coreboot_init_cpus(void *unused) static void coreboot_init_cpus(void *unused)

View File

@ -23,16 +23,6 @@ int get_cpu_count(void);
*/ */
void get_microcode_info(const void **microcode, int *parallel); void get_microcode_info(const void **microcode, int *parallel);
/*
* Perform BSP and AP initialization
* This function can be called in below cases
* 1. During coreboot is doing MP initialization as part of BS_DEV_INIT_CHIPS (exclude
* this call if user has selected USE_INTEL_FSP_MP_INIT)
* 2. coreboot would like to take APs control back after FSP-S has done with MP
* initialization based on user select USE_INTEL_FSP_MP_INIT
*/
void init_cpus(void);
/* /*
* This function will perform any recommended CPU (BSP and AP) initialization * This function will perform any recommended CPU (BSP and AP) initialization
* after coreboot has done the multiprocessor initialization (before FSP-S) * after coreboot has done the multiprocessor initialization (before FSP-S)
@ -52,14 +42,4 @@ void before_post_cpus_init(void);
*/ */
void soc_core_init(struct device *dev); void soc_core_init(struct device *dev);
/*
* In this function SOC must fill required mp_ops params, also it
* should call these mp_ops callback functions by calling
* mp_init_with_smm() function from x86/mp_init.c file.
*
* Also, if there is any other SOC specific functionalities to be
* implemented before or after MP Init, it can be done here.
*/
void soc_init_cpus(struct bus *cpu_bus);
#endif /* SOC_INTEL_COMMON_BLOCK_MP_INIT_H */ #endif /* SOC_INTEL_COMMON_BLOCK_MP_INIT_H */

View File

@ -137,7 +137,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(cpu_bus, &mp_ops); mp_init_with_smm(cpu_bus, &mp_ops);

View File

@ -131,7 +131,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(cpu_bus, &mp_ops); mp_init_with_smm(cpu_bus, &mp_ops);

View File

@ -167,7 +167,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
if (mp_init_with_smm(cpu_bus, &mp_ops)) if (mp_init_with_smm(cpu_bus, &mp_ops))
printk(BIOS_ERR, "MP initialization failure.\n"); printk(BIOS_ERR, "MP initialization failure.\n");

View File

@ -236,7 +236,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(cpu_bus, &mp_ops); mp_init_with_smm(cpu_bus, &mp_ops);

View File

@ -137,7 +137,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(struct bus *cpu_bus) void mp_init_cpus(struct bus *cpu_bus)
{ {
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(cpu_bus, &mp_ops); mp_init_with_smm(cpu_bus, &mp_ops);

View File

@ -49,7 +49,7 @@ static struct device_operations pci_domain_ops = {
static struct device_operations cpu_bus_ops = { static struct device_operations cpu_bus_ops = {
.read_resources = noop_read_resources, .read_resources = noop_read_resources,
.set_resources = noop_set_resources, .set_resources = noop_set_resources,
.init = cpx_init_cpus, .init = mp_cpu_bus_init,
.acpi_fill_ssdt = generate_cpu_entries, .acpi_fill_ssdt = generate_cpu_entries,
}; };

View File

@ -211,7 +211,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void cpx_init_cpus(struct device *dev) void mp_init_cpus(struct bus *bus)
{ {
microcode_patch = intel_microcode_find(); microcode_patch = intel_microcode_find();
@ -221,13 +221,13 @@ void cpx_init_cpus(struct device *dev)
intel_microcode_load_unlocked(microcode_patch); intel_microcode_load_unlocked(microcode_patch);
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(dev->link_list, &mp_ops); mp_init_with_smm(bus, &mp_ops);
/* /*
* chip_config is used in cpu device callback. Other than cpu 0, * chip_config is used in cpu device callback. Other than cpu 0,
* rest of the CPU devices do not have chip_info updated. * rest of the CPU devices do not have chip_info updated.
*/ */
chip_config = dev->chip_info; chip_config = bus->dev->chip_info;
/* update numa domain for all cpu devices */ /* update numa domain for all cpu devices */
xeonsp_init_cpu_config(); xeonsp_init_cpu_config();

View File

@ -35,7 +35,7 @@ static struct device_operations pci_domain_ops = {
static struct device_operations cpu_bus_ops = { static struct device_operations cpu_bus_ops = {
.read_resources = noop_read_resources, .read_resources = noop_read_resources,
.set_resources = noop_set_resources, .set_resources = noop_set_resources,
.init = xeon_sp_init_cpus, .init = mp_cpu_bus_init,
#if CONFIG(HAVE_ACPI_TABLES) #if CONFIG(HAVE_ACPI_TABLES)
/* defined in src/soc/intel/common/block/acpi/acpi.c */ /* defined in src/soc/intel/common/block/acpi/acpi.c */
.acpi_fill_ssdt = generate_cpu_entries, .acpi_fill_ssdt = generate_cpu_entries,

View File

@ -228,7 +228,7 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void xeon_sp_init_cpus(struct device *dev) void mp_init_cpus(struct bus *bus)
{ {
FUNC_ENTER(); FUNC_ENTER();
@ -237,13 +237,13 @@ void xeon_sp_init_cpus(struct device *dev)
* rest of the CPU devices do not have * rest of the CPU devices do not have
* chip_info updated. Global chip_config is used as workaround * chip_info updated. Global chip_config is used as workaround
*/ */
chip_config = dev->chip_info; chip_config = bus->dev->chip_info;
config_reset_cpl3_csrs(); config_reset_cpl3_csrs();
/* calls src/cpu/x86/mp_init.c */ /* calls src/cpu/x86/mp_init.c */
/* TODO: Handle mp_init_with_smm failure? */ /* TODO: Handle mp_init_with_smm failure? */
mp_init_with_smm(dev->link_list, &mp_ops); mp_init_with_smm(bus, &mp_ops);
/* update numa domain for all cpu devices */ /* update numa domain for all cpu devices */
xeonsp_init_cpu_config(); xeonsp_init_cpu_config();