[Skiboot] [PATCH] Fix booting & OPAL call return values with DEBUG=1

Stewart Smith stewart at linux.vnet.ibm.com
Wed Dec 6 16:56:47 AEDT 2017


On a debug build, _mcount would trash r3 and opal_exit_check
would not restore it, leaving OPAL calls returning garbage.

this fix simply preserves the return value and doesn't let
the compiler get fancy on us. We effectively just get an
extra `mr` instruction to restore r3.

Fixes: 9c565ee6bca4b665d9d1120bfff5e88ee80615bc
Reported-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Reported-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
Suggested-by: Nicholas Piggin <npiggin at gmail.com>
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/opal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/opal.c b/core/opal.c
index 193dc89805de..d33d527c7dec 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -171,9 +171,9 @@ again:
 	return OPAL_SUCCESS;
 }
 
-void opal_exit_check(int64_t retval, struct stack_frame *eframe);
+int64_t opal_exit_check(int64_t retval, struct stack_frame *eframe);
 
-void opal_exit_check(int64_t retval, struct stack_frame *eframe)
+int64_t opal_exit_check(int64_t retval, struct stack_frame *eframe)
 {
 	struct cpu_thread *cpu = this_cpu();
 	uint64_t token = eframe->gpr[0];
@@ -185,6 +185,7 @@ void opal_exit_check(int64_t retval, struct stack_frame *eframe)
 		sync(); /* release barrier vs quiescing */
 		cpu->in_opal_call--;
 	}
+	return retval;
 }
 
 int64_t opal_quiesce(uint32_t quiesce_type, int32_t cpu_target)
-- 
2.14.3



More information about the Skiboot mailing list