[Skiboot] [PATCH V4 6/6] opal/errorlog : Enables error log write to host on BMC systems
Mukesh Ojha
mukesh02 at linux.vnet.ibm.com
Tue Jul 26 15:45:38 AEST 2016
Adds the support of error log write to host on BMC based system by using the
generic interface of error log read/write framework. OPAL sents the error log
messages to both BMC and host kernel by passing the error log buffers.
It moves the content of 'elog_init' routine to new routine 'opal_elog_init'
and removes 'elog_init' usage. 'opal_elog_init' initialises the memory and the
callbacks require for error log write to host framework.
Signed-off-by: Mukesh Ojha <mukesh02 at linux.vnet.ibm.com>
---
Changes in V4:
- Changes are rebased on master.
Changes in V3:
- Moves the unrelated changes to 2/3 as per review comment.
Changes in V2:
- Changes description.
- get_elog, put_elog routine and ref_count variable implementation move to
the separate patch 5/6
core/errorlog.c | 18 ++++++------------
hw/ipmi/ipmi-sel.c | 11 +++++++++++
include/errorlog.h | 1 -
platforms/astbmc/common.c | 6 +++---
4 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/core/errorlog.c b/core/errorlog.c
index 432e3c7..87e7ecf 100644
--- a/core/errorlog.c
+++ b/core/errorlog.c
@@ -442,17 +442,6 @@ static bool opal_kexec_elog_notify(void *data __unused)
return true;
}
-int elog_init(void)
-{
- /* Pre-allocate memory for records */
- if (pool_init(&elog_pool, sizeof(struct errorlog),
- ELOG_WRITE_MAX_RECORD, 1))
- return OPAL_RESOURCE;
-
- elog_available = true;
- return 0;
-}
-
void opal_elog_init(void)
{
elog_enabled = true;
@@ -466,5 +455,10 @@ void opal_elog_init(void)
opal_register(OPAL_ELOG_ACK, opal_elog_ack, 1);
opal_register(OPAL_ELOG_RESEND, opal_resend_pending_logs, 0);
opal_register(OPAL_ELOG_SIZE, opal_elog_info, 3);
- elog_init();
+ /* Pre-allocate memory for records */
+ if (pool_init(&elog_pool, sizeof(struct errorlog),
+ ELOG_WRITE_MAX_RECORD, 1))
+ return;
+
+ elog_available = true;
}
diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index e131b0e..f41f079 100644
--- a/hw/ipmi/ipmi-sel.c
+++ b/hw/ipmi/ipmi-sel.c
@@ -408,12 +408,21 @@ int ipmi_elog_commit(struct errorlog *elog_buf)
{
struct ipmi_msg *msg;
+ get_elog(elog_buf);
+ /*
+ * We take get_elog two times to make sure errorlog will be sent to
+ * both BMC and the host irrespective of either of them is complete
+ * or not, buffer will be return to the pool during the call of
+ * opal_elog_complete.
+ */
+ get_elog(elog_buf);
/* Only log events that needs attention */
if (elog_buf->event_severity <
OPAL_PREDICTIVE_ERR_FAULT_RECTIFY_REBOOT ||
elog_buf->elog_origin != ORG_SAPPHIRE) {
prlog(PR_INFO, "dropping non severe PEL event\n");
opal_elog_complete(elog_buf, true);
+ elog_append_write_to_host(elog_buf);
return 0;
}
/*
@@ -424,6 +433,7 @@ int ipmi_elog_commit(struct errorlog *elog_buf)
msg = ipmi_sel_alloc_msg(elog_buf);
if (!msg) {
opal_elog_complete(elog_buf, false);
+ elog_append_write_to_host(elog_buf);
return OPAL_RESOURCE;
}
@@ -434,6 +444,7 @@ int ipmi_elog_commit(struct errorlog *elog_buf)
else
ipmi_queue_msg(msg);
+ elog_append_write_to_host(elog_buf);
return 0;
}
diff --git a/include/errorlog.h b/include/errorlog.h
index fd95afa..5278c6d 100644
--- a/include/errorlog.h
+++ b/include/errorlog.h
@@ -374,7 +374,6 @@ void log_commit(struct errorlog *elog);
void opal_elog_complete(struct errorlog *elog, bool success);
void elog_append_write_to_host(struct errorlog *buf);
void get_elog(struct errorlog *elog_buf);
-int elog_init(void);
void opal_elog_init(void);
void elog_set_head_state(bool opal_logs, enum elog_head_state state);
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index e1a8a4d..d9fa712 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2014 IBM Corp.
+/* Copyright 2013-2016 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,8 +120,8 @@ void astbmc_init(void)
/* Register the BT interface with the IPMI layer */
bt_init();
- /* Initialize elog */
- elog_init();
+ /* Initialize the error log framework */
+ opal_elog_init();
ipmi_sel_init();
ipmi_wdt_init();
ipmi_rtc_init();
--
2.7.4
More information about the Skiboot
mailing list