Skip to content

Commit

Permalink
Use the HSM SBI extension to halt CPUs
Browse files Browse the repository at this point in the history
Differential Revision:	https://reviews.freebsd.org/D24498
  • Loading branch information
mhorne committed May 1, 2020
1 parent c749595 commit 4d7e913
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sys/riscv/riscv/machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,16 @@ void
cpu_halt(void)
{

/*
* Try to power down using the HSM SBI extension and fall back to a
* simple wfi loop.
*/
intr_disable();
if (sbi_probe_extension(SBI_EXT_ID_HSM) != 0)
sbi_hsm_hart_stop();
for (;;)
__asm __volatile("wfi");
/* NOTREACHED */
}

/*
Expand Down

0 comments on commit 4d7e913

Please sign in to comment.