aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2020-05-01 21:59:47 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2020-05-01 21:59:47 +0000
commit4d7e9134bb1f9745229a350b5a3014af64650012 (patch)
tree9eaecd46683ae3b10b9e2a7212b0e0720e14cfdf
parentc74959537c4d1d8679dc75ab9a50f97473d0a92b (diff)
Use the HSM SBI extension to halt CPUs
Differential Revision: https://reviews.freebsd.org/D24498
Notes
Notes: svn path=/head/; revision=360554
-rw-r--r--sys/riscv/riscv/machdep.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
index 109337230db3..9dacd4b9d3a1 100644
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -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 */
}
/*