From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [kvm-unit-tests PATCH v5 18/18] powerpc/ppc64: make a fake debug-exit Date: Fri, 19 Feb 2016 15:12:47 +1100 Message-ID: <20160219041247.GY15224@voom.fritz.box> References: <1455734459-31902-1-git-send-email-drjones@redhat.com> <1455734459-31902-19-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nynJ8Zgemp8dhn89" Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, thuth@redhat.com, dgibson@redhat.com, agraf@suse.de, lvivier@redhat.com, pbonzini@redhat.com, rkrcmar@redhat.com To: Andrew Jones Return-path: Received: from ozlabs.org ([103.22.144.67]:57478 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424429AbcBSE1h (ORCPT ); Thu, 18 Feb 2016 23:27:37 -0500 Content-Disposition: inline In-Reply-To: <1455734459-31902-19-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: --nynJ8Zgemp8dhn89 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 17, 2016 at 07:40:59PM +0100, 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). >=20 > (When we've got a real debug-exit working, then this patch can > be reverted.) >=20 > Signed-off-by: Andrew Jones > Reviewed-by: Thomas Huth > Tested-by: Laurent Vivier Reviewed-by: David Gibson > --- > lib/powerpc/io.c | 4 ++++ > powerpc/run | 7 +++++-- > 2 files changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c > index c4c61ea8ac1cf..6a94bcc4f76d4 100644 > --- a/lib/powerpc/io.c > +++ b/lib/powerpc/io.c > @@ -29,5 +29,9 @@ void puts(const char *s) > =20 > 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=3D%d\n", ((code) << 1) | 1); > + rtas_power_off(); > halt(code); > } > diff --git a/powerpc/run b/powerpc/run > index c5108100fc5e0..45492a1cb8afc 100755 > --- a/powerpc/run > +++ b/powerpc/run > @@ -46,7 +46,10 @@ command=3D"$qemu $M -bios $FIRMWARE" > command+=3D" -display none -serial stdio -kernel" > echo $command "$@" > =20 > -$command "$@" > -ret=3D$? > +#FIXME: rtas-poweroff always exits with zero, so we have to parse > +# the true exit code from the output. > +lines=3D$($command "$@") > +echo "$lines" > +ret=3D$(grep '^EXIT: ' <<<"$lines" | sed 's/.*STATUS=3D\([0-9][0-9]*\).*= /\1/') > echo Return value from qemu: $ret > exit $ret --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --nynJ8Zgemp8dhn89 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWxpY/AAoJEGw4ysog2bOShHgQAI+WH7mWyzlA2CKTjQI/Wp9u wUjFtqdQUzyu9fgZ9TVX1J+VAgQ+2YJRJikzIbhjmDmm0RCa6wC3/tM9hS9JblCX jU4EqHulXDsIOxuEqcSKKR9iU2iUO2F4GThFKnjicDk7/mPJbcwIDQPvdjVks8yf T7DQ+dJW98+yMe9TN4Q0bOkX8BHkDDs6SYT5ruzq1fAhtrs4U/L7raH72HkREjQN L2yJD1nNWWX/zUYtTH3ue/w0YeVHmjf6BL6cn44oa66yRZlE+EuG2JEmC4uZJpj1 1oCVHsxKcKz8rW9v5E2XbSPKZyCSr9z+RnxrtIJPEhrpMTJB1AAQ8MTD+iBHmRGg QmdcM4gfD6bFPxACJC47ePbvD6EGCgtrjwuwBbpPntVXXB05eIb54lkfimuCB4+M /wvyE9LEmR5000kAPZLWfDp0xOPtwisK0LLZfeHkKYrbcBbGtc+Mxahj3qADsLM6 Kj4ZCerC9NedyYvdq5D8BFvhL7jlgAltNe7XwoYXdpZBa2nagaXiBaVBi+s3BKhe jucMvW1TTDjyfDc8v4SrkmD/9C8SbGXTUcDBPnSi26k/NPjf2qKLyCkRWyvOM8HA FpHm9/aLPP9+8I95x9iwEWG4ZGBbwQRkPjHV2m4BuvEUQxVP1XGWpCOs5482MSeq N/LV+hLaC0WmYnMqIRMH =tSj+ -----END PGP SIGNATURE----- --nynJ8Zgemp8dhn89--