public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: alexandru.elisei@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com
Subject: [PATCH kvm-unit-tests] arm: powerpc: comment halt(code)
Date: Tue,  9 Apr 2019 14:51:04 +0200	[thread overview]
Message-ID: <20190409125104.28900-1-drjones@redhat.com> (raw)

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


             reply	other threads:[~2019-04-09 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 12:51 Andrew Jones [this message]
2019-04-09 12:58 ` [PATCH kvm-unit-tests] arm: powerpc: comment halt(code) Thomas Huth
2019-04-09 13:11 ` Alexandru Elisei
2019-04-09 16:33 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190409125104.28900-1-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=alexandru.elisei@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox