Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 May 2020 21:59:47 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r360554 - head/sys/riscv/riscv
Message-ID:  <202005012159.041Lxlwc014889@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005012159.041Lxlwc014889>