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 */
 }
 
 /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to