git: b5d826b1b6bc - stable/14 - change ipmi watchdog to awlays stop when system is halted

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 17 Feb 2024 15:12:26 UTC
The branch stable/14 has been updated by avg:

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

commit b5d826b1b6bc863ae2d72b6ba18d0ece424e9824
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2023-01-03 17:26:45 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-02-17 14:15:11 +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.
    
    (cherry picked from commit 8fdb26160160c4507eb2f644a982a3e05984cdf6)
---
 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 3f66c3c199e3..d311f168baf5 100644
--- a/sys/dev/ipmi/ipmi.c
+++ b/sys/dev/ipmi/ipmi.c
@@ -767,6 +767,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
@@ -774,7 +778,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;