[Skiboot] [PATCH 2/4] ELOG: Improve elog event states

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Jun 24 20:39:17 AEST 2016


ELOG enables event notification once new log is available. And this
will be disabled after host completes reading logs (it has to complete
both fsp_opal_elog_info and fsp_opal_elog_read).

Ideally we should disable notification as soon as host consumes event.
(after fsp_opal_elog_info). Also if host fails to call fsp_opal_elog_read
(ex: situations like duplicate event), then we endup keeping notification
forever.

This patch introduces new ELOG state (ELOG_STATE_HOST_INFO). As soon as
host consumes event elog will move to this new state so that event
notification is disabled.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/fsp/fsp-elog-read.c |    3 ++-
 include/fsp-elog.h     |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/fsp/fsp-elog-read.c b/hw/fsp/fsp-elog-read.c
index c63198f..40575f0 100644
--- a/hw/fsp/fsp-elog-read.c
+++ b/hw/fsp/fsp-elog-read.c
@@ -294,6 +294,7 @@ static int64_t fsp_opal_elog_info(uint64_t *opal_elog_id,
 	}
 	*opal_elog_id = log_data->log_id;
 	*opal_elog_size = log_data->log_size;
+	fsp_elog_set_head_state(ELOG_STATE_HOST_INFO);
 	unlock(&elog_read_lock);
 	return OPAL_SUCCESS;
 }
@@ -314,7 +315,7 @@ static int64_t fsp_opal_elog_read(uint64_t *buffer, uint64_t opal_elog_size,
 	 * as we know always top record of the list is fetched from FSP
 	 */
 	lock(&elog_read_lock);
-	if (elog_read_from_fsp_head_state != ELOG_STATE_FETCHED_DATA) {
+	if (elog_read_from_fsp_head_state != ELOG_STATE_HOST_INFO) {
 		unlock(&elog_read_lock);
 		return OPAL_WRONG_STATE;
 	}
diff --git a/include/fsp-elog.h b/include/fsp-elog.h
index 1522b18..f1c49a5 100644
--- a/include/fsp-elog.h
+++ b/include/fsp-elog.h
@@ -31,6 +31,7 @@ enum elog_head_state {
 	ELOG_STATE_FETCHING,    /*In the process of reading log from FSP. */
 	ELOG_STATE_FETCHED_INFO,/* Indicates reading log info is completed */
 	ELOG_STATE_FETCHED_DATA,/* Indicates reading log is completed */
+	ELOG_STATE_HOST_INFO,	/* Host read log info */
 	ELOG_STATE_NONE,        /* Indicates to fetch next log */
 	ELOG_STATE_REJECTED,    /* resend all pending logs to linux */
 };



More information about the Skiboot mailing list