[Skiboot-stable] [PATCH] FSP/IPMI: Handle FSP reset reload

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue Nov 26 02:19:14 AEDT 2019


FSP IPMI driver serializes ipmi messages. It sends message to FSP and waits
for response before sending new message. It works fine as long as we get
response from FSP on time.

If we have inflight ipmi message during FSP R/R, we will not get resonse
from FSP. So if we initiate inband FSP R/R then all subsequent inband ipmi
message gets blocked.

Sequence:
  - ipmitool mc reset cold
  - <FSP R/R complete>
  - ipmitool <any command> <-- gets blocked

This patch clears inflight ipmi messages after FSP R/R complete.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
Cc: skiboot-stable at lists.ozlabs.org
---
 hw/fsp/fsp-ipmi.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/hw/fsp/fsp-ipmi.c b/hw/fsp/fsp-ipmi.c
index 025dd019f..7b20f3cd5 100644
--- a/hw/fsp/fsp-ipmi.c
+++ b/hw/fsp/fsp-ipmi.c
@@ -70,6 +70,10 @@ static void fsp_ipmi_cmd_done(uint8_t cmd, uint8_t netfn, uint8_t cc)
 	struct fsp_ipmi_msg *fsp_ipmi_msg = fsp_ipmi.cur_msg;
 
 	lock(&fsp_ipmi.lock);
+	if (fsp_ipmi.cur_msg == NULL) {
+		unlock(&fsp_ipmi.lock);
+		return;
+	}
 	list_del(&fsp_ipmi_msg->link);
 	fsp_ipmi.cur_msg = NULL;
 	unlock(&fsp_ipmi.lock);
@@ -251,6 +255,35 @@ static struct ipmi_backend fsp_ipmi_backend = {
 	.poll           = NULL,
 };
 
+static bool fsp_ipmi_rr_notify(uint32_t cmd_sub_mod,
+			       struct fsp_msg *msg __unused)
+{
+	struct ipmi_msg *ipmi_msg;
+
+	switch (cmd_sub_mod) {
+	case FSP_RESET_START:
+		return true;
+	case FSP_RELOAD_COMPLETE:
+		/*
+		 * We will not get response for outstanding request. Send error
+		 * message to caller and start sending new ipmi messages.
+		 */
+		if (fsp_ipmi.cur_msg) {
+			ipmi_msg = &fsp_ipmi.cur_msg->ipmi_msg;
+			fsp_ipmi_cmd_done(ipmi_msg->cmd,
+					  IPMI_NETFN_RETURN_CODE(ipmi_msg->netfn),
+					  IPMI_ERR_UNSPECIFIED);
+		}
+		fsp_ipmi_send_request();
+		return true;
+	}
+	return false;
+}
+
+static struct fsp_client fsp_ipmi_client_rr = {
+	.message = fsp_ipmi_rr_notify,
+};
+
 static bool fsp_ipmi_send_response(uint32_t cmd)
 {
 	struct fsp_msg *resp;
@@ -364,5 +397,6 @@ void fsp_ipmi_init(void)
 	init_lock(&fsp_ipmi.lock);
 
 	fsp_register_client(&fsp_ipmi_client, FSP_MCLASS_FETCH_SPDATA);
+	fsp_register_client(&fsp_ipmi_client_rr, FSP_MCLASS_RR_EVENT);
 	ipmi_register_backend(&fsp_ipmi_backend);
 }
-- 
2.21.0



More information about the Skiboot-stable mailing list