aboutsummaryrefslogtreecommitdiff
path: root/hw/ipmi
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-05-23 17:13:31 -0700
committerStewart Smith <stewart@linux.ibm.com>2018-06-01 02:07:26 -0500
commitc9f363245238b746660dd6198d4c28c7529dacea (patch)
treed5e3792095c5db3b6e4341c2f1c6884025f5df35 /hw/ipmi
parent84995f90049782e04981ff74cd373677f45f8eba (diff)
downloadskiboot-c9f363245238b746660dd6198d4c28c7529dacea.zip
skiboot-c9f363245238b746660dd6198d4c28c7529dacea.tar.gz
skiboot-c9f363245238b746660dd6198d4c28c7529dacea.tar.bz2
ipmi-watchdog: Add a flag to determine if we are still ticking
This makes it easier for future changes to ensure that the watchdog stops ticking and doesn't requeue itself for execution in the background. This way it is safe for resets to be performed after the ticks are assumed to be stopped and it won't start the timer again. Signed-off-by: William A. Kennington III <wak@google.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw/ipmi')
-rw-r--r--hw/ipmi/ipmi-watchdog.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c
index b5cb5fe..fc559c6 100644
--- a/hw/ipmi/ipmi-watchdog.c
+++ b/hw/ipmi/ipmi-watchdog.c
@@ -46,11 +46,12 @@ more frequently than necessary. */
#define WDT_MARGIN 300
static struct timer wdt_timer;
-static bool wdt_stopped = false;
+static bool wdt_stopped;
+static bool wdt_ticking;
static void ipmi_wdt_complete(struct ipmi_msg *msg)
{
- if (msg->cmd == IPMI_CMD(IPMI_RESET_WDT) && !msg->user_data)
+ if (msg->cmd == IPMI_CMD(IPMI_RESET_WDT) && wdt_ticking)
schedule_timer(&wdt_timer, msecs_to_tb(
(WDT_TIMEOUT - WDT_MARGIN)*100));
@@ -121,11 +122,18 @@ void ipmi_wdt_stop(void)
void ipmi_wdt_final_reset(void)
{
+ /* We can safely stop the timer prior to setting up our final
+ * watchdog timeout since we have enough margin before the
+ * timeout. */
+ wdt_ticking = false;
+ cancel_timer(&wdt_timer);
+
+ /* Configure the watchdog and make sure it is still enabled */
set_wdt(WDT_RESET_ACTION | WDT_PRETIMEOUT_SMI, WDT_TIMEOUT,
WDT_MARGIN/10, true);
sync_reset_wdt();
+
ipmi_set_boot_count();
- cancel_timer(&wdt_timer);
}
void ipmi_wdt_init(void)
@@ -136,6 +144,7 @@ void ipmi_wdt_init(void)
/* Start the WDT. We do it synchronously to make sure it has
* started before skiboot continues booting. Otherwise we
* could crash before the wdt has actually been started. */
+ wdt_ticking = true;
sync_reset_wdt();
return;