Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion arch/riscv/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,14 @@ SYM_CODE_START(_start_kernel)
* get far enough along the boot process that it should continue.
*/
.Lwait_for_cpu_up:
/* FIXME: We should WFI to save some energy here. */
/*
* Wait for the boot hart to populate the stack and task pointers.
* Use WFI to avoid burning power in a busy-wait loop. Per the
* RISC-V privileged spec, WFI wakes on a pending interrupt even
* with global interrupts disabled (e.g. SIE=0), and implementations
* are permitted to treat it as a NOP, so this is always safe.
*/
wfi
REG_L sp, (a1)
REG_L tp, (a2)
beqz sp, .Lwait_for_cpu_up
Expand Down