[Skiboot] [PATCH v2 3/6] FSP/ELOG: Improve elog event states

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Sun Jul 3 01:33:40 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 d55c858..c7582bc 100644
--- a/hw/fsp/fsp-elog-read.c
+++ b/hw/fsp/fsp-elog-read.c
@@ -320,6 +320,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;
 }
@@ -340,7 +341,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 37a1953..a796f5e 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 */
 };
-- 
2.5.5



More information about the Skiboot mailing list