From patchwork Mon Feb 8 18:53:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 580470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42D7F140C33 for ; Tue, 9 Feb 2016 05:54:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755006AbcBHSx7 (ORCPT ); Mon, 8 Feb 2016 13:53:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35566 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754490AbcBHSxx (ORCPT ); Mon, 8 Feb 2016 13:53:53 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 765B0C0A8042; Mon, 8 Feb 2016 18:53:53 +0000 (UTC) Received: from hawk.localdomain.com (dhcp-1-158.brq.redhat.com [10.34.1.158]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u18IrHb4006285; Mon, 8 Feb 2016 13:53:51 -0500 From: Andrew Jones To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Cc: thuth@redhat.com, dgibson@redhat.com, david@gibson.dropbear.id.au, agraf@suse.de, lvivier@redhat.com, pbonzini@redhat.com Subject: [kvm-unit-tests PATCH v2 14/14] powerpc/ppc64: HACK: make a fake debug-exit Date: Mon, 8 Feb 2016 19:53:14 +0100 Message-Id: <1454957594-30601-15-git-send-email-drjones@redhat.com> In-Reply-To: <1454957594-30601-1-git-send-email-drjones@redhat.com> References: <1454957594-30601-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org 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 --- lib/powerpc/io.c | 4 ++++ powerpc/run | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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