aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2024-03-19 17:56:24 +0530
committerAnup Patel <anup@brainfault.org>2024-04-05 17:48:25 +0530
commit7862c244bce024e921705d7d2e19cf855557d481 (patch)
treea06a4a1f787a6525131cdc026ee0b417ba08accb
parentbeb0cd177f10a6bdafd73aac19059fecf6a07a91 (diff)
downloadopensbi-7862c244bce024e921705d7d2e19cf855557d481.zip
opensbi-7862c244bce024e921705d7d2e19cf855557d481.tar.gz
opensbi-7862c244bce024e921705d7d2e19cf855557d481.tar.bz2
lib: sbi: Wakeup non-coldboot HARTs early in the coldboot path
Currently, all non-coldboot HARTs busy spin in wait_for_coldboot() until the entire coldboot init sequence is completed. This means: 1) On QEMU, all non-coldboot HARTs will eat host CPU time and also slow down the coldboot HART until the entire coldboot init sequence is completed. 2) On real HW, all non-coldboot HARTs will consume more CPU power until the entire coldboot init sequence is completed. To address this, wake up all non-coldboot HARTs as early as possible in the coldboot init sequence. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
-rw-r--r--lib/sbi/sbi_init.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
index 6166491..389172a 100644
--- a/lib/sbi/sbi_init.c
+++ b/lib/sbi/sbi_init.c
@@ -244,6 +244,14 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
if (rc)
sbi_hart_hang();
+ /*
+ * All non-coldboot HARTs do HSM initialization (i.e. enter HSM state
+ * machine) at the start of the warmboot path so it is wasteful to
+ * have these HARTs busy spin in wait_for_coldboot() until coldboot
+ * path is completed.
+ */
+ wake_coldboot_harts(scratch, hartid);
+
rc = sbi_platform_early_init(plat, true);
if (rc)
sbi_hart_hang();
@@ -355,8 +363,6 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
sbi_hart_hang();
}
- wake_coldboot_harts(scratch, hartid);
-
count = sbi_scratch_offset_ptr(scratch, init_count_offset);
(*count)++;
@@ -376,6 +382,7 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch,
count = sbi_scratch_offset_ptr(scratch, entry_count_offset);
(*count)++;
+ /* Note: This has to be first thing in warmboot init sequence */
rc = sbi_hsm_init(scratch, hartid, false);
if (rc)
sbi_hart_hang();