git: 8fdb26160160 - main - change ipmi watchdog to awlays stop when system is halted

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sun, 28 Jan 2024 12:47:57 UTC
The branch main has been updated by avg:

URL: https://cgit.FreeBSD.org/src/commit/?id=8fdb26160160c4507eb2f644a982a3e05984cdf6

commit 8fdb26160160c4507eb2f644a982a3e05984cdf6
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2023-01-03 17:26:45 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-01-28 12:45:16 +0000

    change ipmi watchdog to awlays stop when system is halted
    
    That is, wd_shutdown_countdown value is ignored when halting.
    
    A halted system should remain halted for as long as needed until
    a power cycle, so the watchdog should not reset the system.
---
 sys/dev/ipmi/ipmi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c
index 06b0760b002c..efb8a7e7669b 100644
--- a/sys/dev/ipmi/ipmi.c
+++ b/sys/dev/ipmi/ipmi.c
@@ -766,6 +766,10 @@ ipmi_shutdown_event(void *arg, int howto)
 	 * Zero value in wd_shutdown_countdown will disable watchdog;
 	 * Negative value in wd_shutdown_countdown will keep existing state;
 	 *
+	 * System halt is a special case of shutdown where wd_shutdown_countdown
+	 * is ignored and watchdog is disabled to ensure that the system remains
+	 * halted as requested.
+	 *
 	 * Revert to using a power cycle to ensure that the watchdog will
 	 * do something useful here.  Having the watchdog send an NMI
 	 * instead is useless during shutdown, and might be ignored if an
@@ -773,7 +777,7 @@ ipmi_shutdown_event(void *arg, int howto)
 	 */
 
 	wd_in_shutdown = true;
-	if (wd_shutdown_countdown == 0) {
+	if (wd_shutdown_countdown == 0 || (howto & RB_HALT) != 0) {
 		/* disable watchdog */
 		ipmi_set_watchdog(sc, 0);
 		sc->ipmi_watchdog_active = 0;