summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Ploetz <maploetz@us.ibm.com>2016-04-12 11:31:23 -0500
committerMatthew A. Ploetz <maploetz@us.ibm.com>2016-05-11 12:12:30 -0400
commita2eeea7a4f8441d241251e1411735302144ca3bf (patch)
tree089bf223ec674cc03610917022360db99b181c68 /src
parent1d150b6e4e679d4c1248e9e49c1d2ccec2483b63 (diff)
downloadtalos-hostboot-a2eeea7a4f8441d241251e1411735302144ca3bf.tar.gz
talos-hostboot-a2eeea7a4f8441d241251e1411735302144ca3bf.zip
Increment reboot count when gard records are written
Change-Id: Iaf9a4d4be19877e564ca1871564467441b472253 CQ:SW347568 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23186 Reviewed-by: A. P. Williams III <iawillia@us.ibm.com> Tested-by: Jenkins Server Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Matthew A. Ploetz <maploetz@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24340
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/errl/errlmanager.H22
-rw-r--r--src/include/usr/initservice/istepdispatcherif.H14
-rw-r--r--src/usr/errl/errlmanager.C43
-rw-r--r--src/usr/hwas/hwasPlatDeconfigGard.C14
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.C61
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.H11
6 files changed, 161 insertions, 4 deletions
diff --git a/src/include/usr/errl/errlmanager.H b/src/include/usr/errl/errlmanager.H
index 7112a85eb..1fbc7aa9d 100644
--- a/src/include/usr/errl/errlmanager.H
+++ b/src/include/usr/errl/errlmanager.H
@@ -176,6 +176,18 @@ public:
static void errlAckErrorlog(uint32_t i_eid);
/**
+ * @brief Calls flush error logs
+ *
+ * This is called by doIstep after every istep to ensure that the error
+ * logs have been cleared out before checking if a reconfigure loop
+ * is needed
+ *
+ * It is a static function because a module cannot call an interface on a
+ * singleton in another module
+ */
+ static void callFlushErrorLogs();
+
+ /**
* @brief Returns the HWAS ProcessCallout function pointer
*
* This is called by ErrlEntry::commit to get the HWAS ProcessCallout
@@ -242,6 +254,7 @@ private:
ERRLOG_ACCESS_TARG_TYPE = 0x00000036 | MBOX::FIRST_SECURE_MSG,
ERRLOG_ACCESS_ERRLDISP_TYPE = 0x00000037 | MBOX::FIRST_SECURE_MSG,
ERRLOG_ACCESS_IPMI_TYPE = 0x00000038 | MBOX::FIRST_SECURE_MSG,
+ ERRLOG_FLUSH_TYPE = 0x00000039 | MBOX::FIRST_SECURE_MSG,
};
/**
@@ -281,6 +294,15 @@ private:
void sendResourcesMsg(errlManagerNeeds i_needs);
/**
+ * @brief Flushes out the error log queue before calling to process
+ * deferred deconfigs
+ *
+ * called by static callFlushErrorLogs function.
+ */
+
+ void flushErrorLogs();
+
+ /**
* @brief Sends msg to errlmanager telling which errlog to ack
*
* called by static errlAckErrorlog function.
diff --git a/src/include/usr/initservice/istepdispatcherif.H b/src/include/usr/initservice/istepdispatcherif.H
index bbec9480b..69cebf0a8 100644
--- a/src/include/usr/initservice/istepdispatcherif.H
+++ b/src/include/usr/initservice/istepdispatcherif.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
+/* Contributors Listed Below - COPYRIGHT 2012,2016 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -79,6 +79,18 @@ bool isShutdownRequested ( void );
*/
void setAcceptIstepMessages ( bool i_accept );
+/**
+ * @brief This function will set a member class variable to state new gard
+ * records have been committed on this boot attempt.
+ *
+ * Gard records being created are an indication of forward progress. Therefore
+ * if a gard record has been created we can issue a reboot that does not count
+ * towards the reboot count limit.
+ *
+ * @return None.
+ */
+void setNewGardRecord ( void );
+
}
#endif
diff --git a/src/usr/errl/errlmanager.C b/src/usr/errl/errlmanager.C
index ac0174713..d693d7a82 100644
--- a/src/usr/errl/errlmanager.C
+++ b/src/usr/errl/errlmanager.C
@@ -51,6 +51,7 @@
#include <console/consoleif.H>
#include <config.h>
#include <functional>
+#include <hwas/common/deconfigGard.H>
namespace ERRORLOG
{
@@ -583,6 +584,13 @@ void ErrlManager::errlogMsgHndlr ()
}
break;
}
+ case ERRLOG_FLUSH_TYPE:
+ TRACFCOMP( g_trac_errl, INFO_MRK "Flush message received" );
+
+ // Since the errorlog is FIFO, all we need to do is respond
+ // to this message
+ msg_respond ( iv_msgQ, theMsg );
+ break;
case ERRLOG_SHUTDOWN_TYPE:
TRACFCOMP( g_trac_errl, INFO_MRK "Shutdown event received" );
@@ -755,7 +763,42 @@ void ErrlManager::saveErrLogEntry( errlHndl_t& io_err )
}
#endif
+///////////////////////////////////////////////////////////////////////////////
+// ErrlManager::callFlushErrorLogs()
+///////////////////////////////////////////////////////////////////////////////
+void ErrlManager::callFlushErrorLogs()
+{
+ ERRORLOG::theErrlManager::instance().flushErrorLogs();
+ return;
+}
+///////////////////////////////////////////////////////////////////////////////
+// ErrlManager::flushErrorLogs()
+///////////////////////////////////////////////////////////////////////////////
+void ErrlManager::flushErrorLogs()
+{
+ TRACDCOMP( g_trac_errl, ENTER_MRK "ErrlManager::flushErrorLogs" );
+
+ // Create message to send to msg handler
+ msg_t *msg = NULL;
+ msg = msg_allocate();
+ msg->type = ERRLOG_FLUSH_TYPE;
+ do{
+ // Send message to msg handler, get msg back on l_RecvMsgQ
+ int rc = msg_sendrecv(iv_msgQ,msg);
+ if(rc)
+ {
+ TRACFCOMP(g_trac_errl, "Error sending error log flush message. "
+ "RC= %d",rc);
+ break;
+ }
+ // Msg_sendrecv doesn't return until the message has been responded
+ // to. So we do not need to check message type back.
+ }while(0);
+
+ TRACDCOMP( g_trac_errl, EXIT_MRK"ErrlManager::flushErrorLogs" );
+ return;
+}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void ErrlManager::setHwasProcessCalloutFn(HWAS::processCalloutFn i_fn)
diff --git a/src/usr/hwas/hwasPlatDeconfigGard.C b/src/usr/hwas/hwasPlatDeconfigGard.C
index 0377cbd10..b98fa28d8 100644
--- a/src/usr/hwas/hwasPlatDeconfigGard.C
+++ b/src/usr/hwas/hwasPlatDeconfigGard.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2015 */
+/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <sys/mm.h>
#include <config.h>
+#include <initservice/istepdispatcherif.H>
#include <pnor/pnorif.H>
@@ -380,6 +381,17 @@ errlHndl_t DeconfigGard::platCreateGardRecord(
l_pRecord->iv_padding[5] = 0;
_flush((void *)l_pRecord);
+
+ // We wrote a new gard record, we need to make sure to increment the
+ // reboot count so we can reconfigure and attempt to IPL
+ // Call setNewGardRecord in initservice.
+ #ifndef __HOSTBOOT_RUNTIME
+ #ifdef CONFIG_BMC_IPMI
+ HWAS_INF("New gard record committed, call INITSERVICE "
+ "::setNewGardRecord()");
+ INITSERVICE::setNewGardRecord();
+ #endif
+ #endif
}
while (0);
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
index 88cafc7e7..cec5013ea 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
@@ -42,6 +42,7 @@
#include <sys/task.h> // tid_t, task_create, etc
#include <sys/misc.h> // cpu_all_winkle
#include <errl/errlentry.H> // errlHndl_t
+#include <errl/errlmanager.H>
#include <initservice/isteps_trace.H> // ISTEPS_TRACE buffer
#include <initservice/initsvcudistep.H> // InitSvcUserDetailsIstep
#include <initservice/taskargs.H> // TASK_ENTRY_MACRO
@@ -120,7 +121,8 @@ IStepDispatcher::IStepDispatcher() :
iv_futureShutdown(false),
iv_istepToCompleteBeforeShutdown(0),
iv_substepToCompleteBeforeShutdown(0),
- iv_acceptIstepMessages(true)
+ iv_acceptIstepMessages(true),
+ iv_newGardRecord(false)
{
mutex_init(&iv_bkPtMutex);
@@ -540,6 +542,39 @@ errlHndl_t IStepDispatcher::executeAllISteps()
else
{
#ifdef CONFIG_BMC_IPMI
+ // Check the newGardRecord instance variable
+ if(iv_newGardRecord)
+ {
+ // We have a new gard record committed. We need
+ // to increment the reboot count
+ uint16_t l_count = 0;
+ SENSOR::RebootCountSensor l_sensor;
+ // Read reboot count sensor
+ err = l_sensor.getRebootCount(l_count);
+ if (err)
+ {
+ TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: getRebootCount failed");
+ break;
+ }
+ // Increment reboot count
+ l_count++;
+ err = l_sensor.setRebootCount(l_count);
+ if (err)
+ {
+ TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: setRebootCount failed");
+ break;
+ }
+ }
+ else
+ {
+ // We are in a reconfig loop, but no new gard
+ // records have been set. We will not increment
+ // the reboot count.
+ TRACFCOMP(g_trac_initsvc, "Reconfig loop needed "
+ "but no new gard records were commited. Do "
+ "not increment reboot count.");
+ }
+
// @TODO RTC:124679 - Remove Once BMC Monitors
// Shutdown Attention
// Set Watchdog Timer before calling doShutdown()
@@ -782,6 +817,11 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep,
{
// There was no PLD, process any deferred deconfig records (i.e.
// actually do the deconfigures)
+ // We need to flush the errl buffer first
+ ERRORLOG::ErrlManager::callFlushErrorLogs();
+
+ // Regardless of the way the flush came back, we need to try to
+ // process the deferred deconfigs
HWAS::theDeconfigGard().processDeferredDeconfig();
}
@@ -1407,6 +1447,20 @@ void IStepDispatcher::iStepBreakPoint(uint32_t i_info)
TRACFCOMP(g_trac_initsvc, EXIT_MRK"IStepDispatcher::handleBreakpointMsg");
mutex_unlock(&iv_bkPtMutex);
}
+// -----------------------------------------------------------------------------
+// IStepDispatcher::setNewGardRecord()
+// -----------------------------------------------------------------------------
+void IStepDispatcher::setNewGardRecord()
+{
+ TRACDCOMP(g_trac_initsvc, ENTER_MRK"IStepDispatcher::setNewGardRecord");
+
+ mutex_lock(&iv_mutex);
+ iv_newGardRecord = true;
+ mutex_unlock(&iv_mutex);
+
+ TRACDCOMP(g_trac_initsvc, EXIT_MRK"IStepDispatcher::setNewGardRecord");
+ return;
+}
// ----------------------------------------------------------------------------
// IStepDispatcher::isShutdownRequested()
@@ -1982,6 +2036,11 @@ void setAcceptIstepMessages(bool i_accept)
{
return IStepDispatcher::getTheInstance().setAcceptIstepMessages(i_accept);
}
+void setNewGardRecord()
+{
+ return IStepDispatcher::getTheInstance().setNewGardRecord();
+}
+
// ----------------------------------------------------------------------------
// IStepDispatcher::getIstepInfo()
// ----------------------------------------------------------------------------
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.H b/src/usr/initservice/istepdispatcher/istepdispatcher.H
index 5d941963c..186639fa6 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.H
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* Contributors Listed Below - COPYRIGHT 2011,2016 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -197,6 +197,12 @@ public:
void setAcceptIstepMessages(bool accept);
+ /**
+ * @brief This function will set a boolean true which states a new gard
+ * record has been written.
+ */
+ void setNewGardRecord();
+
protected:
/**
@@ -415,6 +421,9 @@ private:
// accept istep messages or not
bool iv_acceptIstepMessages;
+ // Instance variable to state if a new gard record was committed
+ bool iv_newGardRecord;
+
// Message Queue for receiving message from SP or SPless user console
msg_q_t iv_msgQ;
OpenPOWER on IntegriCloud