kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] arm: powerpc: comment halt(code)
@ 2019-04-09 12:51 Andrew Jones
  2019-04-09 12:58 ` Thomas Huth
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Jones @ 2019-04-09 12:51 UTC (permalink / raw)
  To: kvm; +Cc: alexandru.elisei, pbonzini, rkrcmar

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.

Suggested-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/arm/io.c     | 10 ++++++++--
 lib/powerpc/io.c |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/arm/io.c b/lib/arm/io.c
index 8226b765bdc5..99fd31560084 100644
--- a/lib/arm/io.c
+++ b/lib/arm/io.c
@@ -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);
diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c
index 217eb0770ef5..a381688bce51 100644
--- a/lib/powerpc/io.c
+++ b/lib/powerpc/io.c
@@ -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(),
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH kvm-unit-tests] arm: powerpc: comment halt(code)
  2019-04-09 12:51 [PATCH kvm-unit-tests] arm: powerpc: comment halt(code) Andrew Jones
@ 2019-04-09 12:58 ` Thomas Huth
  2019-04-09 13:11 ` Alexandru Elisei
  2019-04-09 16:33 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2019-04-09 12:58 UTC (permalink / raw)
  To: Andrew Jones, kvm; +Cc: alexandru.elisei, pbonzini, rkrcmar

On 09/04/2019 14.51, Andrew Jones wrote:
> 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.
> 
> Suggested-by: Alexandru Elisei <alexandru.elisei@arm.com>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  lib/arm/io.c     | 10 ++++++++--
>  lib/powerpc/io.c |  9 +++++++--
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/arm/io.c b/lib/arm/io.c
> index 8226b765bdc5..99fd31560084 100644
> --- a/lib/arm/io.c
> +++ b/lib/arm/io.c
> @@ -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);
> diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c
> index 217eb0770ef5..a381688bce51 100644
> --- a/lib/powerpc/io.c
> +++ b/lib/powerpc/io.c
> @@ -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);

Acked-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH kvm-unit-tests] arm: powerpc: comment halt(code)
  2019-04-09 12:51 [PATCH kvm-unit-tests] arm: powerpc: comment halt(code) Andrew Jones
  2019-04-09 12:58 ` Thomas Huth
@ 2019-04-09 13:11 ` Alexandru Elisei
  2019-04-09 16:33 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Alexandru Elisei @ 2019-04-09 13:11 UTC (permalink / raw)
  To: Andrew Jones, kvm; +Cc: pbonzini, rkrcmar

On 4/9/19 1:51 PM, Andrew Jones wrote:
> 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.
>
> Suggested-by: Alexandru Elisei <alexandru.elisei@arm.com>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  lib/arm/io.c     | 10 ++++++++--
>  lib/powerpc/io.c |  9 +++++++--
>  2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/lib/arm/io.c b/lib/arm/io.c
> index 8226b765bdc5..99fd31560084 100644
> --- a/lib/arm/io.c
> +++ b/lib/arm/io.c
> @@ -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);
> diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c
> index 217eb0770ef5..a381688bce51 100644
> --- a/lib/powerpc/io.c
> +++ b/lib/powerpc/io.c
> @@ -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(),
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH kvm-unit-tests] arm: powerpc: comment halt(code)
  2019-04-09 12:51 [PATCH kvm-unit-tests] arm: powerpc: comment halt(code) Andrew Jones
  2019-04-09 12:58 ` Thomas Huth
  2019-04-09 13:11 ` Alexandru Elisei
@ 2019-04-09 16:33 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2019-04-09 16:33 UTC (permalink / raw)
  To: Andrew Jones, kvm; +Cc: alexandru.elisei, rkrcmar

On 09/04/19 14:51, Andrew Jones wrote:
> 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.
> 
> Suggested-by: Alexandru Elisei <alexandru.elisei@arm.com>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  lib/arm/io.c     | 10 ++++++++--
>  lib/powerpc/io.c |  9 +++++++--
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/arm/io.c b/lib/arm/io.c
> index 8226b765bdc5..99fd31560084 100644
> --- a/lib/arm/io.c
> +++ b/lib/arm/io.c
> @@ -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);
> diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c
> index 217eb0770ef5..a381688bce51 100644
> --- a/lib/powerpc/io.c
> +++ b/lib/powerpc/io.c
> @@ -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(),
> 

Pushed, thanks.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-09 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 12:51 [PATCH kvm-unit-tests] arm: powerpc: comment halt(code) Andrew Jones
2019-04-09 12:58 ` Thomas Huth
2019-04-09 13:11 ` Alexandru Elisei
2019-04-09 16:33 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).