From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk7nK-0000eC-2h for qemu-devel@nongnu.org; Wed, 14 Sep 2016 06:51:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bk7nF-0002PF-UE for qemu-devel@nongnu.org; Wed, 14 Sep 2016 06:51:57 -0400 Date: Wed, 14 Sep 2016 20:51:26 +1000 From: David Gibson Message-ID: <20160914105126.GT15077@voom.fritz.box> References: <1473771165-23804-1-git-send-email-lvivier@redhat.com> <1473771165-23804-4-git-send-email-lvivier@redhat.com> <20160914032240.GF15077@voom.fritz.box> <20160914110547.046697cb@bahia> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OelmujB7rQAg+yu0" Content-Disposition: inline In-Reply-To: <20160914110547.046697cb@bahia> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v8 3/3] tests: add RTAS command in the protocol List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: Laurent Vivier , thuth@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org --OelmujB7rQAg+yu0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 14, 2016 at 11:05:47AM +0200, Greg Kurz wrote: > On Wed, 14 Sep 2016 13:22:40 +1000 > David Gibson wrote: >=20 > > On Tue, Sep 13, 2016 at 02:52:45PM +0200, Laurent Vivier wrote: > > > Add a first test to validate the protocol: > > >=20 > > > - rtas/get-time-of-day compares the time > > > from the guest with the time from the host. > > >=20 > > > Signed-off-by: Laurent Vivier > > > Reviewed-by: Greg Kurz =20 > >=20 > > Reviewed-by: David Gibson > >=20 > > > --- > > > v8: > > > - add Greg's Rb > > > - exit if RTAS is not started with qemu-system-ppc64 > > >=20 > > > v7: > > > - don't allocate twice the memory for the RTAS call > > > - add "-machine pseries" in rtas-test > > >=20 > > > v6: > > > - rebase > > >=20 > > > v5: > > > - use qtest_spapr_boot() instead of machine_alloc_init() > > >=20 > > > v4: > > > - use qemu_strtoXXX() instead strtoXX() > > >=20 > > > v3: > > > - use mktimegm() instead of timegm() > > >=20 > > > v2: > > > - add a missing space in qrtas_call() prototype > > >=20 > > > hw/ppc/spapr_rtas.c | 19 ++++++++++++ > > > include/hw/ppc/spapr_rtas.h | 10 +++++++ > > > qtest.c | 17 +++++++++++ > > > tests/Makefile.include | 3 ++ > > > tests/libqos/rtas.c | 71 +++++++++++++++++++++++++++++++++++= ++++++++++ > > > tests/libqos/rtas.h | 11 +++++++ > > > tests/libqtest.c | 10 +++++++ > > > tests/libqtest.h | 15 ++++++++++ > > > tests/rtas-test.c | 41 ++++++++++++++++++++++++++ > > > 9 files changed, 197 insertions(+) > > > create mode 100644 include/hw/ppc/spapr_rtas.h > > > create mode 100644 tests/libqos/rtas.c > > > create mode 100644 tests/libqos/rtas.h > > > create mode 100644 tests/rtas-test.c > > >=20 > > > diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c > > > index 27b5ad4..b80c1db 100644 > > > --- a/hw/ppc/spapr_rtas.c > > > +++ b/hw/ppc/spapr_rtas.c > > > @@ -37,6 +37,7 @@ > > > =20 > > > #include "hw/ppc/spapr.h" > > > #include "hw/ppc/spapr_vio.h" > > > +#include "hw/ppc/spapr_rtas.h" > > > #include "hw/ppc/ppc.h" > > > #include "qapi-event.h" > > > #include "hw/boards.h" > > > @@ -692,6 +693,24 @@ target_ulong spapr_rtas_call(PowerPCCPU *cpu, sP= APRMachineState *spapr, > > > return H_PARAMETER; > > > } > > > =20 > > > +uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args, > > > + uint32_t nret, uint64_t rets) > > > +{ > > > + int token; > > > + > > > + for (token =3D 0; token < RTAS_TOKEN_MAX - RTAS_TOKEN_BASE; toke= n++) { > > > + if (strcmp(cmd, rtas_table[token].name) =3D=3D 0) { > > > + sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_mach= ine()); =20 > >=20 > > As a sanity check you could return an error if you're unable to > > resolve the machine as an sPAPR here. Since that should only happen > > on a broken testcase, it can be done as a later enhancement, though. > >=20 >=20 > Hmm... if the machine isn't sPAPR, SPAPR_MACHINE() will abort, which makes > sense in the case of a broken testcase. >=20 > hw/ppc/spapr_rtas.c:703:qtest_rtas_call: Object 0x558f5de65590 is > not an instance of type spapr-machine Ah, sorry, I'd forgotten. I had mixed it up with object_dynamic_cast() and was thinking it just returned NULL. So we implicitly have the check I was asking for. --=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 --OelmujB7rQAg+yu0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJX2SuuAAoJEGw4ysog2bOSKCoQAIGLtTiW8Jhfc/xsM86JMy6T aq8Jk4G+qoroUvaqQT+waWAlwzwFCYIALvDAKFJS515zUKH3BCWxVQ4B2P7tTGJ1 vRCRjDYtVYtE0qM8AVYag+h5MGtZjhspgqFgDoN9C6PnURYO0xlNuUSP4yK18hJI gIzrI+6TGbTHwwlq4baHy2fqacLFwdMhHOw2lCpzqvPnMieF64XXzKa/k6MV6/HQ auduAqIc2Iv6qx7l7x1QJCWNgVyyqniiY6n/tci0FFjoXlxSQT4xAt1czPLR1WNZ yJBXjIuwznLq0poBhbrucr71psqqVPR/ma2waNO9QxDczAXQ0qZDPMLvvqjHqkT1 zt3txTmM1WR7n9DxiS+13VcmLXfabYjbOyJleIYGSf0qVcJF2zcwLp/t1kDW0z0d aBTa+IdplIzpspY7dSNrqdqicETZPc2HuMegcy7X5bRFCGbr6S5/drjK4zb8wKmo 3wUXbS8cGQDW/veh4uD/5ZXNc/EVGkilkFVP4+EBZPjOI7fw0Qv+2bfhoMPG8SgF drynhqH7DOVNEpHlF/uFeQsRQbq30n9qLS7smQkEOOhbmV7JNF4MM/4ZjPHQyN2a vDTSM9ACFGyLijEtAZ5oQBB6AeQjTjpfm/lT65CZtdDkCeq4F0mePfFyIcmlEv7k fGzSJM0RLYDKlmBIsIp1 =JT+D -----END PGP SIGNATURE----- --OelmujB7rQAg+yu0--