Skip to contentSkip to conversation

arm: powerpc: comment halt(code)

PATCH In review Andrew Jones 4 participants 4 messages Apr 9, 2019 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: powerpc: comment halt(code)

We're being a bit tricky when we change the prototype of halt() to take 'code' as an argument. Doing this gives us a last chance to see it when inspecting the halted unit test state (it'll be in r0/x0 for arm/arm64 and r3 for powerpc.) Let's comment this trick to avoid confusion.

---
 lib/arm/io.c     | 10 ++++++++--
 lib/powerpc/io.c |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
lib/arm/io.c +8 -2
index 8226b765bdc5..99fd31560084 100644
@@ -18,8 +18,6 @@
 
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock uart_lock;
 /*
  * Use this guess for the uart base in order to make an attempt at
@@ -89,6 +87,14 @@ void puts(const char *s)
 	spin_unlock(&uart_lock);
 }
 
+
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in x0/r0 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
+
 void exit(int code)
 {
 	chr_testdev_exit(code);
lib/powerpc/io.c +7 -2
index 217eb0770ef5..a381688bce51 100644
@@ -11,8 +11,6 @@
 #include <asm/setup.h>
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock print_lock;
 
 void io_init(void)
@@ -28,6 +26,13 @@ void puts(const char *s)
 	spin_unlock(&print_lock);
 }
 
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in r3 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
+
 void exit(int code)
 {
 // FIXME: change this print-exit/rtas-poweroff to chr_testdev_exit(),
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 55 lines · Andrew Jones

We're being a bit tricky when we change the prototype of halt() to take 'code' as an argument. Doing this gives us a last chance to see it when inspecting the halted unit test state (it'll be in r0/x0 for arm/arm64 and r3 for powerpc.) Let's comment this trick to avoid confusion.

---
 lib/arm/io.c     | 10 ++++++++--
 lib/powerpc/io.c |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
lib/arm/io.c +8 -2
index 8226b765bdc5..99fd31560084 100644
@@ -18,8 +18,6 @@
 
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock uart_lock;
 /*
  * Use this guess for the uart base in order to make an attempt at
@@ -89,6 +87,14 @@ void puts(const char *s)
 	spin_unlock(&uart_lock);
 }
 
+
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in x0/r0 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
+
 void exit(int code)
 {
 	chr_testdev_exit(code);
lib/powerpc/io.c +0 -2
index 217eb0770ef5..a381688bce51 100644
@@ -11,8 +11,6 @@
 #include <asm/setup.h>
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock print_lock;
 
 void io_init(void)

lib/powerpc/io.c void puts(const char *s) · line 34

Quoted 9 lines
lib/powerpc/io.c +6 -0
@@ -28,6 +26,13 @@ void puts(const char *s)
 	spin_unlock(&print_lock);
 }
 
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in r3 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Jones
Quoted 58 lines · Andrew Jones

We're being a bit tricky when we change the prototype of halt() to take 'code' as an argument. Doing this gives us a last chance to see it when inspecting the halted unit test state (it'll be in r0/x0 for arm/arm64 and r3 for powerpc.) Let's comment this trick to avoid confusion.

---
 lib/arm/io.c     | 10 ++++++++--
 lib/powerpc/io.c |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
lib/arm/io.c +8 -2
index 8226b765bdc5..99fd31560084 100644
@@ -18,8 +18,6 @@
 
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock uart_lock;
 /*
  * Use this guess for the uart base in order to make an attempt at
@@ -89,6 +87,14 @@ void puts(const char *s)
 	spin_unlock(&uart_lock);
 }
 
+
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in x0/r0 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
+
 void exit(int code)
 {
 	chr_testdev_exit(code);
lib/powerpc/io.c +0 -2
index 217eb0770ef5..a381688bce51 100644
@@ -11,8 +11,6 @@
 #include <asm/setup.h>
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock print_lock;
 
 void io_init(void)
@@ -28,6 +26,13 @@ void puts(const char *s)
 	spin_unlock(&print_lock);
 }
 

lib/powerpc/io.c void puts(const char *s) · line 38

Quoted 10 lines
lib/powerpc/io.c +7 -0
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in r3 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
+
 void exit(int code)
 {
 // FIXME: change this print-exit/rtas-poweroff to chr_testdev_exit(),
maintainer
#3 lore raw
In reply to Andrew Jones
Quoted 59 lines · Andrew Jones

We're being a bit tricky when we change the prototype of halt() to take 'code' as an argument. Doing this gives us a last chance to see it when inspecting the halted unit test state (it'll be in r0/x0 for arm/arm64 and r3 for powerpc.) Let's comment this trick to avoid confusion.

---
 lib/arm/io.c     | 10 ++++++++--
 lib/powerpc/io.c |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
lib/arm/io.c +8 -2
index 8226b765bdc5..99fd31560084 100644
@@ -18,8 +18,6 @@
 
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock uart_lock;
 /*
  * Use this guess for the uart base in order to make an attempt at
@@ -89,6 +87,14 @@ void puts(const char *s)
 	spin_unlock(&uart_lock);
 }
 
+
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in x0/r0 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
+
 void exit(int code)
 {
 	chr_testdev_exit(code);
lib/powerpc/io.c +0 -2
index 217eb0770ef5..a381688bce51 100644
@@ -11,8 +11,6 @@
 #include <asm/setup.h>
 #include "io.h"
 
-extern void halt(int code);
-
 static struct spinlock print_lock;
 
 void io_init(void)
@@ -28,6 +26,13 @@ void puts(const char *s)
 	spin_unlock(&print_lock);
 }
 

lib/powerpc/io.c void puts(const char *s) · line 38

Quoted 10 lines
lib/powerpc/io.c +7 -0
+/*
+ * Defining halt to take 'code' as an argument guarantees that it will
+ * be in r3 when we halt. That gives us a final chance to see the exit
+ * status while inspecting the halted unit test state.
+ */
+extern void halt(int code);
+
 void exit(int code)
 {
 // FIXME: change this print-exit/rtas-poweroff to chr_testdev_exit(),

Pushed, thanks.

Paolo