From 0c0e8ecf0482ce240bd976631cefb6363b91b749 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Fri, 16 Aug 2019 03:57:51 +0200
Subject: [PATCH] fix(lifecycle): Reset API interrupt when looping in reset

When a load fails early and core 1 continues to loop in the reset stub,
Epicardium might lock up when sending an interrupt and waiting for the
API_CALL_MEM->int_id to be reset.

Signed-off-by: Rahix <rahix@rahix.de>
---
 epicardium/api/control.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/epicardium/api/control.c b/epicardium/api/control.c
index daa1ff52..b8987b43 100644
--- a/epicardium/api/control.c
+++ b/epicardium/api/control.c
@@ -132,6 +132,12 @@ void __core1_init(void)
 		/* Signal that we are ready for an IVT address */
 		core1_info.ready = true;
 
+		/*
+		 * Reset the API interrupt so we never block Epicardium when it
+		 * attempts to trigger an interrupt.
+		 */
+		API_CALL_MEM->int_id = (-1);
+
 		SEMA_FreeSema(_CONTROL_SEMAPHORE);
 
 		__WFE();
-- 
GitLab