Message ID | 1454957594-30601-15-git-send-email-drjones@redhat.com |
---|---|
State | Superseded |
Headers | show |
On 08.02.2016 19:53, Andrew Jones wrote: > We should use a QEMU debug-exit device like chr-testdev, but for > now we just fake things by outputting the exit code (which we > parse later) and quitting with RTAS (which always exits with zero). > > (When we've got a real debug-exit working, then this patch can > be reverted.) > > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > lib/powerpc/io.c | 4 ++++ > powerpc/run | 7 +++++-- > 2 files changed, 9 insertions(+), 2 deletions(-) Patch looks fine to me as an initial solution (and I'd also suggest to remove the "HACK" in the title, as Paolo already said). For a future improvement: Not sure, but there is a "ibm,os-term" RTAS call which "[...] is provided for the OS to indicate to the platform that it has terminated normal operation. A string of information is passed to the platform", according to LoPAPR chapter 7.3.9.1. Maybe that could be used to implement the debug-exit functionality? QEMU seems to already send a GUEST_PANIC_ACTION_PAUSE event in this case, but the parameter string is not taken into account yet... Thomas -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 12/02/2016 19:07, Thomas Huth wrote: > For a future improvement: Not sure, but there is a "ibm,os-term" RTAS > call which "[...] is provided for the OS to indicate to the platform > that it has terminated normal operation. A string of information is > passed to the platform", according to LoPAPR chapter 7.3.9.1. Maybe that > could be used to implement the debug-exit functionality? QEMU seems to > already send a GUEST_PANIC_ACTION_PAUSE event in this case, but the > parameter string is not taken into account yet... It also doesn't actually pause, unlike qemu_system_guest_panicked(). It probably should use a different GUEST_PANIC_ACTION (e.g. "report") for the event. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c index e57a28c583eb0..276eb4c0ebd41 100644 --- a/lib/powerpc/io.c +++ b/lib/powerpc/io.c @@ -29,5 +29,9 @@ void puts(const char *s) void exit(int code) { +// FIXME: change this print-exit/rtas-poweroff to chr_testdev_exit() +// Maybe by plugging chr-testdev into a spapr-vty. + printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1); + rtas_power_off(); halt(code); } diff --git a/powerpc/run b/powerpc/run index 4509429f9712b..7247e167e2ac6 100755 --- a/powerpc/run +++ b/powerpc/run @@ -51,7 +51,10 @@ command="$qemu $M -bios $boot_rom" command+=" -display none -serial stdio -kernel" echo $command "$@" -$command "$@" -ret=$? +#FIXME: rtas-poweroff always exits with zero, so we have to parse +# the true exit code from the output. +lines=$($command "$@") +echo "$lines" +ret=$(grep '^EXIT: ' <<<"$lines" | sed 's/.*STATUS=\([0-9][0-9]*\).*/\1/') echo Return value from qemu: $ret exit $ret
We should use a QEMU debug-exit device like chr-testdev, but for now we just fake things by outputting the exit code (which we parse later) and quitting with RTAS (which always exits with zero). (When we've got a real debug-exit working, then this patch can be reverted.) Signed-off-by: Andrew Jones <drjones@redhat.com> --- lib/powerpc/io.c | 4 ++++ powerpc/run | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-)