diff options
author | Ed Tanous <ed.tanous@intel.com> | 2019-08-19 21:16:19 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2019-08-20 18:56:17 +0300 |
commit | 35e295e2a161fcf146ea031de53431b2888521fa (patch) | |
tree | a0c78943fef5c085f371aaa840d46edecc1f2e95 /meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog | |
parent | 9856ac69064742544fafad307d3ee4544385ffa2 (diff) | |
download | openbmc-35e295e2a161fcf146ea031de53431b2888521fa.tar.xz |
Sync to internal 8-19-2019
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog')
2 files changed, 256 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch new file mode 100644 index 000000000..60b605418 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0003-Set-PreTimeoutInterruptOccurFlag-in-DBUS.patch @@ -0,0 +1,45 @@ +From 41f71ecfa2b8339281a33c260d78102453d4ac97 Mon Sep 17 00:00:00 2001 +From: Ren Yu <yux.ren@intel.com> +Date: Tue, 30 Jul 2019 15:31:09 +0800 +Subject: [PATCH] Set PreTimeoutInterruptOccurFlag in DBUS + +Set preTimeoutInterruptOccurFlag in DBUS as 'true' when +watchdog pre-timeout interrupt occurred. +This property is use for recording PreTimeoutInterruptOccurFlag. +In command get message flag, need verify whether pre-timeout +interrupt occurred by it. + +Tested: +Set watchdog timer +(Pre-timeout interrupt is Messaging, Initial Countdown is 2 second). +ipmitool raw 0x06 0x24 0x5 0x30 0x1 0x3e 0x14 0x00 +Start watchdog timer. +ipmitool mc watchdog reset +Wait watchdog timer expired, log into below: +http://BMC-IP:3000/ +xyz.openbmc_project.Watchdog +/xyz/openbmc_project/watchdog/host0 +xyz.openbmc_project.State.Watchdog +check whether the value of PreTimeoutInterruptOccurFlag is true. + +Signed-off-by: Ren Yu <yux.ren@intel.com> +--- + watchdog.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/watchdog.cpp b/watchdog.cpp +index fa58ef4..bdf65da 100644 +--- a/watchdog.cpp ++++ b/watchdog.cpp +@@ -198,6 +198,8 @@ void Watchdog::timeOutHandler() + + if (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction)) + { ++ preTimeoutInterruptOccurFlag(true); ++ + sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", + convertForMessage(preTimeoutInterruptAction).c_str(), + "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", +-- +2.7.4 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch new file mode 100644 index 000000000..578fa1257 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0004-Standardize-watchdog-redfish-format-according-to-EPS.patch @@ -0,0 +1,211 @@ +From 3bead6316f653f14773e65b2f6b8facb08f200e7 Mon Sep 17 00:00:00 2001 +From: Ren Yu <yux.ren@intel.com> +Date: Fri, 9 Aug 2019 14:54:13 +0800 +Subject: [PATCH] Standardize watchdog redfish format according to EPS + +According to EPS and test requirement, change the messageArgs +in redfish about watchdog action and pre-interrupt action and +add timer user display. + +Tested: +Set a watchdog (Timer action and pre-interrupt action both are none). + ipmitool raw 0x06 0x24 0x05 0x00 0x00 0x00 0x30 0x00 +Get the watchdog. + ipmitool mc watchdog get +Start the watchdog. + ipmitool mc watchdog reset +When timer expired, check messageArgs in Redfish with below url: +https://IP/redfish/v1/Systems/system/LogServices/EventLog/Entries. + + "Message": "Host Watchdog Event: Power Cycle - System power cycle due to Watchdog timeout. timer use: SMS/OS", + "MessageArgs": [ + "Power Cycle - System power cycle due to Watchdog timeout. timer use: SMS/OS" + ], + + "Message": "Host Watchdog Event: Timer interrupt - Messaging Interrupt due to Watchdog timeout. timer use: OEM", + "MessageArgs": [ + "Timer interrupt - Messaging Interrupt due to Watchdog timeout. timer use: OEM" + ], + +Signed-off-by: Ren Yu <yux.ren@intel.com> +--- + watchdog.cpp | 127 +++++++++++++++++++++++++++++++++++++++++------------------ + 1 file changed, 89 insertions(+), 38 deletions(-) + +diff --git a/watchdog.cpp b/watchdog.cpp +index bdf65da..7cfcc75 100644 +--- a/watchdog.cpp ++++ b/watchdog.cpp +@@ -25,25 +25,28 @@ const static constexpr char* currentPowerState = "CurrentPowerState"; + const static constexpr char* powerStatusOff = + "xyz.openbmc_project.State.Chassis.PowerState.Off"; + +-const static constexpr char* powerActionHardReset = +- "xyz.openbmc_project.State.Watchdog.Action.HardReset"; +-const static constexpr char* powerActionOff = +- "xyz.openbmc_project.State.Watchdog.Action.PowerOff"; +-const static constexpr char* powerActionPowerCycle = +- "xyz.openbmc_project.State.Watchdog.Action.PowerCycle"; +-const static constexpr char* powerActionNone = +- "xyz.openbmc_project.State.Watchdog.Action.None"; +-const static constexpr char* preInterruptNoAction = +- "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; +- +-const static constexpr char* hardResteDescription = +- "Hard Reset - System reset due to Watchdog timeout"; ++const static constexpr char* actionDescription = " due to Watchdog timeout"; ++const static constexpr char* hardResetDescription = "Hard Reset - System reset"; + const static constexpr char* powerOffDescription = +- "Power Down - System power down due to Watchdog timeout"; ++ "Power Down - System power down"; + const static constexpr char* powerCycleDescription = +- "Power Cycle - System power cycle due to Watchdog timeout"; ++ "Power Cycle - System power cycle"; + const static constexpr char* timerExpiredDescription = "Timer expired"; +-const static constexpr char* preInterruptDescription = "Timer interrupt"; ++ ++const static constexpr char* preInterruptActionNone = ++ "xyz.openbmc_project.State.Watchdog.PreTimeoutInterruptAction.None"; ++ ++const static constexpr char* preInterruptDescriptionSMI = "SMI"; ++const static constexpr char* preInterruptDescriptionNMI = "NMI"; ++const static constexpr char* preInterruptDescriptionMI = "Messaging Interrupt"; ++ ++const static constexpr char* reservedDescription = "Reserved"; ++ ++const static constexpr char* timerUseDescriptionBIOSFRB2 = "BIOS FRB2"; ++const static constexpr char* timerUseDescriptionBIOSPOST = "BIOS/POST"; ++const static constexpr char* timerUseDescriptionOSLoad = "OSLoad"; ++const static constexpr char* timerUseDescriptionSMSOS = "SMS/OS"; ++const static constexpr char* timerUseDescriptionOEM = "OEM"; + + namespace restart + { +@@ -161,54 +164,102 @@ uint64_t Watchdog::interval(uint64_t value) + void Watchdog::timeOutHandler() + { + PreTimeoutInterruptAction preTimeoutInterruptAction = preTimeoutInterrupt(); ++ std::string preInterruptActionMessageArgs{}; ++ + Action action = expireAction(); + std::string actionMessageArgs{}; + ++ expiredTimerUse(currentTimerUse()); ++ ++ TimerUse timeUser = expiredTimerUse(); ++ std::string timeUserMessage{}; ++ + if (!this->enabled()) + { + action = fallback->action; + } + +- if (convertForMessage(action) == powerActionHardReset) +- { +- actionMessageArgs = hardResteDescription; +- } +- else if (convertForMessage(action) == powerActionOff) +- { +- actionMessageArgs = powerOffDescription; +- } +- else if (convertForMessage(action) == powerActionPowerCycle) ++ switch (timeUser) + { +- actionMessageArgs = powerCycleDescription; ++ case Watchdog::TimerUse::BIOSFRB2: ++ timeUserMessage = timerUseDescriptionBIOSFRB2; ++ break; ++ case Watchdog::TimerUse::BIOSPOST: ++ timeUserMessage = timerUseDescriptionBIOSPOST; ++ break; ++ case Watchdog::TimerUse::OSLoad: ++ timeUserMessage = timerUseDescriptionOSLoad; ++ break; ++ case Watchdog::TimerUse::SMSOS: ++ timeUserMessage = timerUseDescriptionSMSOS; ++ break; ++ case Watchdog::TimerUse::OEM: ++ timeUserMessage = timerUseDescriptionOEM; ++ break; ++ default: ++ timeUserMessage = reservedDescription; ++ break; + } +- else if (convertForMessage(action) == powerActionNone) +- { +- actionMessageArgs = timerExpiredDescription; +- } +- else ++ ++ switch (action) + { +- actionMessageArgs = "Reserved"; ++ case Watchdog::Action::HardReset: ++ actionMessageArgs = std::string(hardResetDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::PowerOff: ++ actionMessageArgs = std::string(powerOffDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::PowerCycle: ++ actionMessageArgs = std::string(powerCycleDescription) + ++ std::string(actionDescription); ++ break; ++ case Watchdog::Action::None: ++ actionMessageArgs = timerExpiredDescription; ++ break; ++ default: ++ actionMessageArgs = reservedDescription; ++ break; + } + + // Log into redfish event log + sd_journal_send("MESSAGE=IPMIWatchdog: Timed out ACTION=%s", + convertForMessage(action).c_str(), "PRIORITY=%i", LOG_INFO, + "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.IPMIWatchdog", +- "REDFISH_MESSAGE_ARGS=%s", actionMessageArgs.c_str(), NULL); ++ "REDFISH_MESSAGE_ARGS=%s. timer use: %s", ++ actionMessageArgs.c_str(), timeUserMessage.c_str(), NULL); ++ ++ switch (preTimeoutInterruptAction) ++ { ++ case Watchdog::PreTimeoutInterruptAction::SMI: ++ preInterruptActionMessageArgs = preInterruptDescriptionSMI; ++ break; ++ case Watchdog::PreTimeoutInterruptAction::NMI: ++ preInterruptActionMessageArgs = preInterruptDescriptionNMI; ++ break; ++ case Watchdog::PreTimeoutInterruptAction::MI: ++ preInterruptActionMessageArgs = preInterruptDescriptionMI; ++ break; ++ default: ++ preInterruptActionMessageArgs = reservedDescription; ++ break; ++ } + +- if (preInterruptNoAction != convertForMessage(preTimeoutInterruptAction)) ++ if (preInterruptActionNone != convertForMessage(preTimeoutInterruptAction)) + { + preTimeoutInterruptOccurFlag(true); + + sd_journal_send("MESSAGE=IPMIWatchdog: Pre Timed out Interrupt=%s", + convertForMessage(preTimeoutInterruptAction).c_str(), + "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", +- "OpenBMC.0.1.IPMIWatchdog", "REDFISH_MESSAGE_ARGS=%s", +- preInterruptDescription, NULL); ++ "OpenBMC.0.1.IPMIWatchdog", ++ "REDFISH_MESSAGE_ARGS=Timer interrupt - %s due to " ++ "Watchdog timeout. timer use: %s", ++ preInterruptActionMessageArgs.c_str(), ++ timeUserMessage.c_str(), NULL); + } + +- expiredTimerUse(currentTimerUse()); +- + auto target = actionTargetMap.find(action); + if (target == actionTargetMap.end()) + { +-- +2.7.4 + |