svn commit: r360554 - head/sys/riscv/riscv

Mitchell Horne mhorne at FreeBSD.org
Fri May 1 21:59:47 UTC 2020


Author: mhorne
Date: Fri May  1 21:59:47 2020
New Revision: 360554
URL: https://svnweb.freebsd.org/changeset/base/360554

Log:
  Use the HSM SBI extension to halt CPUs
  
  Differential Revision:	https://reviews.freebsd.org/D24498

Modified:
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/riscv/riscv/machdep.c
==============================================================================
--- head/sys/riscv/riscv/machdep.c	Fri May  1 21:58:19 2020	(r360553)
+++ head/sys/riscv/riscv/machdep.c	Fri May  1 21:59:47 2020	(r360554)
@@ -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 */
 }
 
 /*


More information about the svn-src-head mailing list