[Skiboot] [PATCH 1/3] SBE: Factor out handling of SBE reset

Thiago Jung Bauermann bauerman at linux.ibm.com
Sat Mar 28 12:08:04 AEDT 2020


When we get notified that the SBE was reset, there are a few cleanups that
need to be done in Skiboot. We'll need the same code when handling SBE
interrupts via the Ultravisor, so factor it out.

There's no behavior change.

Signed-off-by: Thiago Jung Bauermann <bauerman at linux.ibm.com>
---
 hw/sbe-p9.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index 53f378e18..5ff44d545 100644
--- a/hw/sbe-p9.c
+++ b/hw/sbe-p9.c
@@ -534,6 +534,23 @@ static void p9_sbe_timer_response(struct p9_sbe *sbe)
 	lock(&sbe->lock);
 }
 
+/* Internal cleanups needed after the SBE is reset. */
+static void p9_sbe_after_reset(struct p9_sbe *sbe)
+{
+	prlog(PR_NOTICE,
+	      "Back from reset [chip id = %x]\n", sbe->chip_id);
+	/* Reset SBE MBOX state */
+	sbe->state = sbe_mbox_idle;
+
+	/* Reset message state */
+	if (!list_empty(&sbe->msg_list)) {
+		struct p9_sbe_msg *msg;
+
+		msg = list_top(&sbe->msg_list, struct p9_sbe_msg, link);
+		msg->state = sbe_msg_queued;
+	}
+}
+
 /* WARNING: This will drop sbe->lock */
 static void __p9_sbe_interrupt(struct p9_sbe *sbe)
 {
@@ -563,16 +580,7 @@ again:
 		if (rc)
 			return;
 
-		prlog(PR_NOTICE,
-		      "Back from reset [chip id = %x]\n", sbe->chip_id);
-		/* Reset SBE MBOX state */
-		sbe->state = sbe_mbox_idle;
-
-		/* Reset message state */
-		if (!list_empty(&sbe->msg_list)) {
-			msg = list_top(&sbe->msg_list, struct p9_sbe_msg, link);
-			msg->state = sbe_msg_queued;
-		}
+		p9_sbe_after_reset(sbe);
 		return;
 	}
 


More information about the Skiboot mailing list