Skip to content

Commit 7862c24

Browse files
committed
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>
1 parent beb0cd1 commit 7862c24

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/sbi/sbi_init.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
244244
if (rc)
245245
sbi_hart_hang();
246246

247+
/*
248+
* All non-coldboot HARTs do HSM initialization (i.e. enter HSM state
249+
* machine) at the start of the warmboot path so it is wasteful to
250+
* have these HARTs busy spin in wait_for_coldboot() until coldboot
251+
* path is completed.
252+
*/
253+
wake_coldboot_harts(scratch, hartid);
254+
247255
rc = sbi_platform_early_init(plat, true);
248256
if (rc)
249257
sbi_hart_hang();
@@ -355,8 +363,6 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
355363
sbi_hart_hang();
356364
}
357365

358-
wake_coldboot_harts(scratch, hartid);
359-
360366
count = sbi_scratch_offset_ptr(scratch, init_count_offset);
361367
(*count)++;
362368

@@ -376,6 +382,7 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch,
376382
count = sbi_scratch_offset_ptr(scratch, entry_count_offset);
377383
(*count)++;
378384

385+
/* Note: This has to be first thing in warmboot init sequence */
379386
rc = sbi_hsm_init(scratch, hartid, false);
380387
if (rc)
381388
sbi_hart_hang();

0 commit comments

Comments
 (0)