diff mbox series

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

Message ID 20200328010806.20621-2-bauerman@linux.ibm.com
State New
Headers show
Series Ultravisor SBE chipops | expand

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d703ad5b8ea93f2bcd98ca2642dcd3c66da82c91)

Commit Message

Thiago Jung Bauermann March 28, 2020, 1:08 a.m. UTC
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@linux.ibm.com>
---
 hw/sbe-p9.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)
diff mbox series

Patch

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;
 	}