platform: generic: Fix fw_platform_coldboot_harts_init() function

It is possible that the OpenSBI config DT node is present but
the "cold-boot-harts" DT property is not present. In this case,
the fw_platform_coldboot_harts_init() will do nothing which
in-turn causes OpenSBI firmware hang at boot time.

To address the above issue, fallback to the default approach
when the "cold-boot-harts" DT property is not present.

Fixes: 67ce5a763c ("platform: generic: Add support for specify coldboot harts in DT")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
This commit is contained in:
Anup Patel
2024-08-25 09:20:15 +05:30
committed by Anup Patel
parent ef4520b1c6
commit c4940a9517

View File

@@ -98,8 +98,10 @@ static void fw_platform_coldboot_harts_init(const void *fdt)
goto default_config; goto default_config;
val = fdt_getprop(fdt, config_offset, "cold-boot-harts", &len); val = fdt_getprop(fdt, config_offset, "cold-boot-harts", &len);
if (!val || !len)
goto default_config;
len = len / sizeof(u32); len = len / sizeof(u32);
if (val && len) {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
cpu_offset = fdt_node_offset_by_phandle(fdt, cpu_offset = fdt_node_offset_by_phandle(fdt,
fdt32_to_cpu(val[i])); fdt32_to_cpu(val[i]));
@@ -117,8 +119,6 @@ static void fw_platform_coldboot_harts_init(const void *fdt)
if (val32 == generic_hart_index2id[i]) if (val32 == generic_hart_index2id[i])
bitmap_set(generic_coldboot_harts, i, 1); bitmap_set(generic_coldboot_harts, i, 1);
} }
}
} }
return; return;