include/device: ensure valid link/bus is passed to mp_cpu_bus_init

When a chipset or mainboard devicetree doesn't have any LAPIC devices in
its CPU cluster, not only the LAPIC device, but also the link/bus
between the CPU cluster device and the LAPIC devices will be missing and
the CPU cluster's dev->link_list will be NULL. This patch handles this
case in the common code like
commit 3c0ecd57c1 (soc/intel/common/cpu:
Handle non-zero BSP APIC ID in init_cpus) and
commit ba936ce5db (soc/intel/denverton_ns:
Ensure CPU device has a valid link) already did in the common Intel SoC
and the Denverton code. With this change all CPUs and SoC that use the
common mp_cpu_bus_init as init function in the CPU cluster's device
operations struct won't require having at least one LAPIC device in the
chipset or mainboard device tree.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Ib0d85de5cafb6390b8fbd512186899d6a815e972
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58508
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Felix Held 2021-10-21 02:03:04 +02:00 committed by Felix Held
parent dc9b5efa81
commit 60e9114c62
1 changed files with 11 additions and 0 deletions

View File

@ -228,6 +228,17 @@ void set_cpu_topology(struct device *cpu, unsigned int node,
void mp_init_cpus(DEVTREE_CONST struct bus *cpu_bus); void mp_init_cpus(DEVTREE_CONST struct bus *cpu_bus);
static inline void mp_cpu_bus_init(struct device *dev) static inline void mp_cpu_bus_init(struct device *dev)
{ {
/*
* When no LAPIC device is specified in the devietree inside the CPU cluster device,
* neither a LAPIC device nor the link/bus between the CPU cluster and the LAPIC device
* will be present in the static device tree and the link_list struct element of the
* CPU cluster device will be NULL. In this case add one link, so that the
* alloc_find_dev calls in init_bsp and allocate_cpu_devices will be able to add a
* LAPIC device for the BSP and the APs on this link/bus.
*/
if (!dev->link_list)
add_more_links(dev, 1);
mp_init_cpus(dev->link_list); mp_init_cpus(dev->link_list);
} }