qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: Laurent Vivier <lvivier@redhat.com>,
	thuth@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v8 3/3] tests: add RTAS command in the protocol
Date: Wed, 14 Sep 2016 20:51:26 +1000	[thread overview]
Message-ID: <20160914105126.GT15077@voom.fritz.box> (raw)
In-Reply-To: <20160914110547.046697cb@bahia>

[-- Attachment #1: Type: text/plain, Size: 3675 bytes --]

On Wed, Sep 14, 2016 at 11:05:47AM +0200, Greg Kurz wrote:
> On Wed, 14 Sep 2016 13:22:40 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Tue, Sep 13, 2016 at 02:52:45PM +0200, Laurent Vivier wrote:
> > > Add a first test to validate the protocol:
> > > 
> > > - rtas/get-time-of-day compares the time
> > >   from the guest with the time from the host.
> > > 
> > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > > Reviewed-by: Greg Kurz <groug@kaod.org>  
> > 
> > Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> > > ---
> > > v8:
> > > - add Greg's Rb
> > > - exit if RTAS is not started with qemu-system-ppc64
> > > 
> > > v7:
> > > - don't allocate twice the memory for the RTAS call
> > > - add "-machine pseries" in rtas-test
> > > 
> > > v6:
> > > - rebase
> > > 
> > > v5:
> > > - use qtest_spapr_boot() instead of machine_alloc_init()
> > > 
> > > v4:
> > > - use qemu_strtoXXX() instead strtoXX()
> > > 
> > > v3:
> > > - use mktimegm() instead of timegm()
> > > 
> > > v2:
> > > - add a missing space in qrtas_call() prototype
> > > 
> > >  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
> > > 
> > > 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 @@
> > >  
> > >  #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, sPAPRMachineState *spapr,
> > >      return H_PARAMETER;
> > >  }
> > >  
> > > +uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
> > > +                         uint32_t nret, uint64_t rets)
> > > +{
> > > +    int token;
> > > +
> > > +    for (token = 0; token < RTAS_TOKEN_MAX - RTAS_TOKEN_BASE; token++) {
> > > +        if (strcmp(cmd, rtas_table[token].name) == 0) {
> > > +            sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());  
> > 
> > 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.
> > 
> 
> Hmm... if the machine isn't sPAPR, SPAPR_MACHINE() will abort, which makes
> sense in the case of a broken testcase.
> 
> 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.

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2016-09-14 10:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13 12:52 [Qemu-devel] [PATCH v8 0/3] tests: add RTAS protocol Laurent Vivier
2016-09-13 12:52 ` [Qemu-devel] [PATCH v8 1/3] qtest: replace strtoXX() by qemu_strtoXX() Laurent Vivier
2016-09-13 12:52 ` [Qemu-devel] [PATCH v8 2/3] libqos: define SPAPR libqos functions Laurent Vivier
2016-09-13 12:52 ` [Qemu-devel] [PATCH v8 3/3] tests: add RTAS command in the protocol Laurent Vivier
2016-09-14  3:22   ` David Gibson
2016-09-14  9:05     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-09-14 10:51       ` David Gibson [this message]
2016-09-14  3:23 ` [Qemu-devel] [PATCH v8 0/3] tests: add RTAS protocol David Gibson
2016-09-14  9:07   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-09-14 10:51     ` David Gibson

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=20160914105126.GT15077@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=lvivier@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@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;
as well as URLs for NNTP newsgroup(s).