[Skiboot] [PATCH] ipmi-sel: Fix esel event logger to handle early boot PANIC events

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Mar 10 17:43:52 AEDT 2016


We pre-allocate IPMI message for PANIC event and use that memory to send
PANIC event to BMC. Presently we return NULL if we have not initiated PANIC
event message. So we won't be able to log early failure events.

This patch tries to initialize ipmi message instead of returning NULL.

Also intialize elog before ipmi_sel_init. Otherwise we will not be able
to create elog message.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
Stewart,
  I've tested this patch by manually adding ELOG in early path. Seems to be working
  fine.

-Vasant

 hw/ipmi/ipmi-sel.c        |   27 +++++++++++++++++----------
 platforms/astbmc/common.c |    3 ++-
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index d9f03d3..59f2eca 100644
--- a/hw/ipmi/ipmi-sel.c
+++ b/hw/ipmi/ipmi-sel.c
@@ -138,6 +138,18 @@ static struct ipmi_sel_panic_msg ipmi_sel_panic_msg;
 /* Forward declaration */
 static void ipmi_elog_poll(struct ipmi_msg *msg);
 
+void ipmi_sel_init(void)
+{
+	/* Already done */
+	if (ipmi_sel_panic_msg.msg != NULL)
+		return;
+
+	memset(&ipmi_sel_panic_msg, 0, sizeof(struct ipmi_sel_panic_msg));
+	ipmi_sel_panic_msg.msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE,
+					    IPMI_RESERVE_SEL, ipmi_elog_poll,
+					    NULL, NULL, IPMI_MAX_REQ_SIZE, 2);
+}
+
 /*
  * Allocate IPMI message
  *  For normal event, allocate memory using ipmi_mkmsg and for PANIC
@@ -149,8 +161,11 @@ static struct ipmi_msg *ipmi_sel_alloc_msg(struct errorlog *elog_buf)
 
 	if (elog_buf->event_severity == OPAL_ERROR_PANIC) {
 		/* Called before initialization completes */
-		if (ipmi_sel_panic_msg.msg == NULL)
-			return NULL;
+		if (ipmi_sel_panic_msg.msg == NULL) {
+			ipmi_sel_init();	/* Try to allocate IPMI message */
+			if (ipmi_sel_panic_msg.msg == NULL)
+				return NULL;
+		}
 
 		if (ipmi_sel_panic_msg.busy == true)
 			return NULL;
@@ -552,11 +567,3 @@ void ipmi_parse_sel(struct ipmi_msg *msg)
 		      sel.cmd);
 	}
 }
-
-void ipmi_sel_init(void)
-{
-	memset(&ipmi_sel_panic_msg, 0, sizeof(struct ipmi_sel_panic_msg));
-	ipmi_sel_panic_msg.msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE,
-					    IPMI_RESERVE_SEL, ipmi_elog_poll,
-					    NULL, NULL, IPMI_MAX_REQ_SIZE, 2);
-}
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 40a9fc8..1ed7d42 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -115,12 +115,13 @@ void astbmc_init(void)
 
 	/* Register the BT interface with the IPMI layer */
 	bt_init();
+	/* Initialize elog */
+	elog_init();
 	ipmi_sel_init();
 	ipmi_wdt_init();
 	ipmi_rtc_init();
 	ipmi_opal_init();
 	astbmc_fru_init();
-	elog_init();
 	ipmi_sensor_init();
 
 	/* As soon as IPMI is up, inform BMC we are in "S0" */



More information about the Skiboot mailing list