From: "Andreas Färber" <afaerber@suse.de>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Paul Mackerras <paulus@samba.org>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
Alex Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 02/12] qtest: add spapr hypercall support
Date: Thu, 20 Jun 2013 17:20:49 +0200 [thread overview]
Message-ID: <51C31DD1.2030603@suse.de> (raw)
In-Reply-To: <1371674435-14973-3-git-send-email-aliguori@us.ibm.com>
Am 19.06.2013 22:40, schrieb Anthony Liguori:
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
> qtest.c | 29 +++++++++++++++++++++++++++++
> tests/libqtest.c | 18 ++++++++++++++++++
> tests/libqtest.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 93 insertions(+)
>
> diff --git a/qtest.c b/qtest.c
> index 07a9612..f8c8f44 100644
> --- a/qtest.c
> +++ b/qtest.c
> @@ -19,6 +19,9 @@
> #include "hw/irq.h"
> #include "sysemu/sysemu.h"
> #include "sysemu/cpus.h"
> +#ifdef TARGET_PPC64
> +#include "hw/ppc/spapr.h"
> +#endif
>
> #define MAX_IRQ 256
>
> @@ -141,6 +144,13 @@ static bool qtest_opened;
> * where NUM is an IRQ number. For the PC, interrupts can be intercepted
> * simply with "irq_intercept_in ioapic" (note that IRQ0 comes out with
> * NUM=0 even though it is remapped to GSI 2).
> + *
> + * Platform specific (sPAPR):
> + *
> + * > papr_hypercall NR ARG0 ARG1 ... ARG8
The functions are called spapr_hcall*() but the protocol uses
papr_hypercall?
> + * < OK RET
> + *
> + * where NR, ARG[0-8] and RET are all integers.
> */
>
> static int hex2nib(char ch)
> @@ -425,6 +435,25 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
> qtest_clock_warp(ns);
> qtest_send_prefix(chr);
> qtest_send(chr, "OK %"PRIi64"\n", (int64_t)qemu_get_clock_ns(vm_clock));
> +#ifdef TARGET_PPC64
> + } else if (strcmp(words[0], "papr_hypercall") == 0) {
> + uint64_t nr;
> + uint64_t args[9];
> + uint64_t ret;
> + int i;
> +
> + memset(args, 0, sizeof(args));
> + g_assert(words[1]);
> + nr = strtoull(words[1], NULL, 0);
> + for (i = 0; i < 9; i++) {
> + if (words[2 + i] == NULL) {
> + break;
> + }
> + args[i] = strtoull(words[2 + i], NULL, 0);
> + }
> + ret = spapr_hypercall(ppc_env_get_cpu(first_cpu), nr, args);
> + qtest_send(chr, "OK 0x%" PRIx64 "\n", ret);
> +#endif
> } else {
> qtest_send_prefix(chr);
> qtest_send(chr, "FAIL Unknown command `%s'\n", words[0]);
> diff --git a/tests/libqtest.c b/tests/libqtest.c
> index 879ffe9..81107cf 100644
> --- a/tests/libqtest.c
> +++ b/tests/libqtest.c
> @@ -544,3 +544,21 @@ void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size)
> qtest_sendf(s, "\n");
> qtest_rsp(s, 0);
> }
> +
> +uint64_t qtest_spapr_hcall9(QTestState *s, uint64_t nr, uint64_t a0,
> + uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4,
> + uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8)
> +{
> + gchar **args;
> + uint64_t value;
> +
> + qtest_sendf(s, "papr_hypercall 0x%" PRIx64 " 0x%" PRIx64
> + " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64
> + " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64
> + "\n", nr, a0, a1, a2, a3, a4, a5, a6, a7, a8);
> + args = qtest_rsp(s, 2);
> + value = strtoull(args[1], NULL, 0);
> + g_strfreev(args);
> +
> + return value;
> +}
> diff --git a/tests/libqtest.h b/tests/libqtest.h
> index 437bda3..592f035 100644
> --- a/tests/libqtest.h
> +++ b/tests/libqtest.h
> @@ -286,6 +286,19 @@ int64_t qtest_clock_step(QTestState *s, int64_t step);
> int64_t qtest_clock_set(QTestState *s, int64_t val);
>
> /**
> + * qtest_spapr_hcall9:
> + * @s: QTestState instance to operate on.
> + * @nr: The hypercall index
> + * @aN: The @Nth hypercall argument
> + *
> + * Issue an sPAPR hypercall
> + *
> + * Returns: The result of the hypercall.
> + */
> +uint64_t qtest_spapr_hcall9(QTestState *s, uint64_t nr, uint64_t a0,
> + uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4,
> + uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8);
> +/**
> * qtest_get_arch:
> *
> * Returns: The architecture for the QEMU executable under test.
> @@ -607,4 +620,37 @@ static inline int64_t clock_set(int64_t val)
> return qtest_clock_set(global_qtest, val);
> }
>
> +static inline uint64_t spapr_hcall0(uint64_t nr)
> +{
> + return qtest_spapr_hcall9(global_qtest, nr, 0, 0, 0, 0, 0, 0, 0, 0, 0);
> +}
> +
> +static inline uint64_t spapr_hcall1(uint64_t nr, uint64_t a0)
> +{
> + return qtest_spapr_hcall9(global_qtest, nr, a0, 0, 0, 0, 0, 0, 0, 0, 0);
> +}
> +
> +static inline uint64_t spapr_hcall2(uint64_t nr, uint64_t a0, uint64_t a1)
> +{
> + return qtest_spapr_hcall9(global_qtest, nr, a0, a1, 0, 0, 0, 0, 0, 0, 0);
> +}
> +
> +static inline uint64_t spapr_hcall3(uint64_t nr, uint64_t a0, uint64_t a1,
> + uint64_t a2)
> +{
> + return qtest_spapr_hcall9(global_qtest, nr, a0, a1, a2, 0, 0, 0, 0, 0, 0);
> +}
> +
> +static inline uint64_t spapr_hcall4(uint64_t nr, uint64_t a0, uint64_t a1,
> + uint64_t a2, uint64_t a3)
> +{
> + return qtest_spapr_hcall9(global_qtest, nr, a0, a1, a2, a3, 0, 0, 0, 0, 0);
> +}
> +
> +static inline uint64_t spapr_hcall5(uint64_t nr, uint64_t a0, uint64_t a1,
> + uint64_t a2, uint64_t a3, uint64_t a4)
> +{
> + return qtest_spapr_hcall9(global_qtest, nr, a0, a1, a2, a3, a4, 0, 0, 0, 0);
> +}
While for a large number of almost identical helpers this certainly
sucks, I made an effort to document all functions in that file, so
please keep it that way. :)
Looks very similar to what I had proposed for s390x, so fine with me.
Regards,
Andreas
> +
> #endif
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-06-20 15:20 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 20:40 [Qemu-devel] [PATCH 00/12] spapr: add qtest support and refactor vty Anthony Liguori
2013-06-19 20:40 ` [Qemu-devel] [PATCH 01/12] chardev: ringbuf: add optional save parameter to save state Anthony Liguori
2013-06-20 19:49 ` Eric Blake
2013-06-19 20:40 ` [Qemu-devel] [PATCH 02/12] qtest: add spapr hypercall support Anthony Liguori
2013-06-20 15:20 ` Andreas Färber [this message]
2013-06-20 15:42 ` Anthony Liguori
2013-06-20 18:43 ` Alexander Graf
2013-06-20 18:58 ` Anthony Liguori
2013-06-20 19:28 ` [Qemu-devel] [Qemu-ppc] " Scott Wood
2013-06-20 21:57 ` [Qemu-devel] " Alexander Graf
2013-06-19 20:40 ` [Qemu-devel] [PATCH 03/12] qtest: return string from QMP commands Anthony Liguori
2013-06-20 15:24 ` Andreas Färber
2013-06-20 15:43 ` Anthony Liguori
2013-06-19 20:40 ` [Qemu-devel] [PATCH 04/12] qtest: add interface to save/restore Anthony Liguori
2013-06-20 15:38 ` Andreas Färber
2013-06-19 20:40 ` [Qemu-devel] [PATCH 05/12] spapr-vty: add qtest test case Anthony Liguori
2013-06-19 21:13 ` Alexander Graf
2013-06-19 21:43 ` Anthony Liguori
2013-06-19 21:47 ` Alexander Graf
2013-06-19 20:40 ` [Qemu-devel] [PATCH 06/12] spapr-vty: add copyright and license Anthony Liguori
2013-06-20 1:45 ` Michael Ellerman
2013-06-20 4:08 ` Alexey Kardashevskiy
2013-06-20 4:43 ` David Gibson
2013-06-20 8:52 ` Paolo Bonzini
2013-06-20 15:47 ` Andreas Färber
2013-06-19 20:40 ` [Qemu-devel] [PATCH 07/12] spapr-rtas: add CPU argument to RTAS calls Anthony Liguori
2013-06-19 21:15 ` Alexander Graf
2013-06-20 15:51 ` Andreas Färber
2013-06-20 16:10 ` Anthony Liguori
2013-06-19 20:40 ` [Qemu-devel] [PATCH 08/12] spapr-rtas: use hypercall interface and remove special vty interfaces Anthony Liguori
2013-06-19 21:24 ` Alexander Graf
2013-06-19 21:45 ` Anthony Liguori
2013-06-19 21:48 ` Alexander Graf
2013-06-19 20:40 ` [Qemu-devel] [PATCH 09/12] spapr-vio: move special case handling for reg=0 to vio Anthony Liguori
2013-06-19 21:28 ` Alexander Graf
2013-06-19 21:49 ` Anthony Liguori
2013-06-19 21:53 ` Alexander Graf
2013-06-19 23:20 ` Anthony Liguori
2013-06-19 23:07 ` Benjamin Herrenschmidt
2013-06-19 20:40 ` [Qemu-devel] [PATCH 10/12] spapr-vty: refactor the code to improve consistency Anthony Liguori
2013-06-19 21:37 ` Alexander Graf
2013-06-19 20:40 ` [Qemu-devel] [PATCH 11/12] spapr-vio: pass type to spapr_vio_find_by_reg() Anthony Liguori
2013-06-19 21:38 ` Alexander Graf
2013-06-19 21:56 ` Anthony Liguori
2013-06-19 20:40 ` [Qemu-devel] [PATCH 12/12] spapr-vty: remove unfixable FIXME Anthony Liguori
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=51C31DD1.2030603@suse.de \
--to=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=aliguori@us.ibm.com \
--cc=paulus@samba.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).