All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: peter.maydell@linaro.org
Cc: agraf@suse.de, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Laurent Vivier <lvivier@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PULL 10/45] libqos: define SPAPR libqos functions
Date: Fri, 23 Sep 2016 17:14:46 +1000	[thread overview]
Message-ID: <1474614921-2221-11-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1474614921-2221-1-git-send-email-david@gibson.dropbear.id.au>

From: Laurent Vivier <lvivier@redhat.com>

Define spapr_alloc_init()/spapr_alloc_init_flags()/spapr_alloc_uninit()

  to allocate and use SPAPR guest memory

Define qtest_spapr_vboot()/qtest_spapr_boot()/qtest_spapr_shutdown()

  to start SPAPR guest with QOSState initialized for it (memory management)

Move qtest_irq_intercept_in() from generic part to PC part.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 tests/Makefile.include      |  2 ++
 tests/libqos/libqos-pc.c    |  2 ++
 tests/libqos/libqos-spapr.c | 30 ++++++++++++++++++++++++++++++
 tests/libqos/libqos-spapr.h | 10 ++++++++++
 tests/libqos/libqos.c       |  1 -
 tests/libqos/malloc-spapr.c | 38 ++++++++++++++++++++++++++++++++++++++
 tests/libqos/malloc-spapr.h | 17 +++++++++++++++++
 7 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 tests/libqos/libqos-spapr.c
 create mode 100644 tests/libqos/libqos-spapr.h
 create mode 100644 tests/libqos/malloc-spapr.c
 create mode 100644 tests/libqos/malloc-spapr.h

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 6052a38..dba35a3 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -583,6 +583,8 @@ tests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
 
 libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o tests/libqos/malloc.o
 libqos-obj-y += tests/libqos/i2c.o tests/libqos/libqos.o
+libqos-spapr-obj-y = $(libqos-obj-y) tests/libqos/malloc-spapr.o
+libqos-spapr-obj-y += tests/libqos/libqos-spapr.o
 libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o
 libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o
 libqos-pc-obj-y += tests/libqos/ahci.o
diff --git a/tests/libqos/libqos-pc.c b/tests/libqos/libqos-pc.c
index 72b5e3b..df34092 100644
--- a/tests/libqos/libqos-pc.c
+++ b/tests/libqos/libqos-pc.c
@@ -21,6 +21,8 @@ QOSState *qtest_pc_boot(const char *cmdline_fmt, ...)
     qs = qtest_vboot(&qos_ops, cmdline_fmt, ap);
     va_end(ap);
 
+    qtest_irq_intercept_in(global_qtest, "ioapic");
+
     return qs;
 }
 
diff --git a/tests/libqos/libqos-spapr.c b/tests/libqos/libqos-spapr.c
new file mode 100644
index 0000000..f19408b
--- /dev/null
+++ b/tests/libqos/libqos-spapr.c
@@ -0,0 +1,30 @@
+#include "qemu/osdep.h"
+#include "libqos/libqos-spapr.h"
+#include "libqos/malloc-spapr.h"
+
+static QOSOps qos_ops = {
+    .init_allocator = spapr_alloc_init_flags,
+    .uninit_allocator = spapr_alloc_uninit
+};
+
+QOSState *qtest_spapr_vboot(const char *cmdline_fmt, va_list ap)
+{
+    return qtest_vboot(&qos_ops, cmdline_fmt, ap);
+}
+
+QOSState *qtest_spapr_boot(const char *cmdline_fmt, ...)
+{
+    QOSState *qs;
+    va_list ap;
+
+    va_start(ap, cmdline_fmt);
+    qs = qtest_vboot(&qos_ops, cmdline_fmt, ap);
+    va_end(ap);
+
+    return qs;
+}
+
+void qtest_spapr_shutdown(QOSState *qs)
+{
+    return qtest_shutdown(qs);
+}
diff --git a/tests/libqos/libqos-spapr.h b/tests/libqos/libqos-spapr.h
new file mode 100644
index 0000000..dcb5c43
--- /dev/null
+++ b/tests/libqos/libqos-spapr.h
@@ -0,0 +1,10 @@
+#ifndef LIBQOS_SPAPR_H
+#define LIBQOS_SPAPR_H
+
+#include "libqos/libqos.h"
+
+QOSState *qtest_spapr_vboot(const char *cmdline_fmt, va_list ap);
+QOSState *qtest_spapr_boot(const char *cmdline_fmt, ...);
+void qtest_spapr_shutdown(QOSState *qs);
+
+#endif
diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c
index c7ba441..a852dc5 100644
--- a/tests/libqos/libqos.c
+++ b/tests/libqos/libqos.c
@@ -20,7 +20,6 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)
     cmdline = g_strdup_vprintf(cmdline_fmt, ap);
     qs->qts = qtest_start(cmdline);
     qs->ops = ops;
-    qtest_irq_intercept_in(global_qtest, "ioapic");
     if (ops && ops->init_allocator) {
         qs->alloc = ops->init_allocator(ALLOC_NO_FLAGS);
     }
diff --git a/tests/libqos/malloc-spapr.c b/tests/libqos/malloc-spapr.c
new file mode 100644
index 0000000..006404a
--- /dev/null
+++ b/tests/libqos/malloc-spapr.c
@@ -0,0 +1,38 @@
+/*
+ * libqos malloc support for SPAPR
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "libqos/malloc-spapr.h"
+
+#include "qemu-common.h"
+
+#define PAGE_SIZE 4096
+
+/* Memory must be a multiple of 256 MB,
+ * so we have at least 256MB
+ */
+#define SPAPR_MIN_SIZE 0x10000000
+
+void spapr_alloc_uninit(QGuestAllocator *allocator)
+{
+    alloc_uninit(allocator);
+}
+
+QGuestAllocator *spapr_alloc_init_flags(QAllocOpts flags)
+{
+    QGuestAllocator *s;
+
+    s = alloc_init_flags(flags, 1 << 20, SPAPR_MIN_SIZE);
+    alloc_set_page_size(s, PAGE_SIZE);
+
+    return s;
+}
+
+QGuestAllocator *spapr_alloc_init(void)
+{
+    return spapr_alloc_init_flags(ALLOC_NO_FLAGS);
+}
diff --git a/tests/libqos/malloc-spapr.h b/tests/libqos/malloc-spapr.h
new file mode 100644
index 0000000..64d0e77
--- /dev/null
+++ b/tests/libqos/malloc-spapr.h
@@ -0,0 +1,17 @@
+/*
+ * libqos malloc support for SPAPR
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef LIBQOS_MALLOC_SPAPR_H
+#define LIBQOS_MALLOC_SPAPR_H
+
+#include "libqos/malloc.h"
+
+QGuestAllocator *spapr_alloc_init(void);
+QGuestAllocator *spapr_alloc_init_flags(QAllocOpts flags);
+void spapr_alloc_uninit(QGuestAllocator *allocator);
+
+#endif
-- 
2.7.4

  parent reply	other threads:[~2016-09-23  7:16 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23  7:14 [Qemu-devel] [PULL 00/45] ppc-for-2.8 queue 20160923 David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 01/45] MAINTAINERS: Add some missing ppc-related files David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 02/45] ppc: restrict the use of the rfi instruction David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 03/45] target-ppc: add vector insert instructions David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 04/45] target-ppc: add vector extract instructions David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 05/45] target-ppc: add vector count trailing zeros instructions David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 06/45] target-ppc: add vector bit permute doubleword instruction David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 07/45] target-ppc: add vector permute right indexed instruction David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 08/45] ppc: Fix signal delivery in ppc-user and ppc64-user David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 09/45] qtest: replace strtoXX() by qemu_strtoXX() David Gibson
2016-09-23  7:14 ` David Gibson [this message]
2016-09-23  7:14 ` [Qemu-devel] [PULL 11/45] tests: add RTAS command in the protocol David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 12/45] MAINTAINERS: add sPAPR tests David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 13/45] adb-keys.h: initial commit David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 14/45] adb.c: add support for QKeyCode David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 15/45] adb.c: correct several key assignments David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 16/45] adb.c: prevent NO_KEY value from going to guest David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 17/45] spapr_drc: convert to trace framework instead of DPRINTF David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 18/45] spapr_rtas: " David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 19/45] spapr_vio: " David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 20/45] spapr_llan: " David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 21/45] spapr_vscsi: " David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 22/45] target-ppc: consolidate load operations David Gibson
2016-09-23  7:14 ` [Qemu-devel] [PULL 23/45] target-ppc: convert ld64 to use new macro David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 24/45] target-ppc: convert ld[16, 32, 64]ur " David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 25/45] target-ppc: consolidate store operations David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 26/45] target-ppc: convert st64 to use new macro David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 27/45] target-ppc: convert st[16, 32, 64]r " David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 28/45] target-ppc: consolidate load with reservation David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 29/45] target-ppc: move out stqcx impementation David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 30/45] target-ppc: consolidate store conditional David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 31/45] target-ppc: add xxspltib instruction David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 32/45] target-ppc: add lxsi[bw]zx instruction David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 33/45] target-ppc: add stxsi[bh]x instruction David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 34/45] target-ppc: implement darn instruction David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 35/45] spapr: Introduce sPAPRCPUCoreClass David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 36/45] target-ppc: add TLB_NEED_LOCAL_FLUSH flag David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 37/45] target-ppc: add flag in check_tlb_flush() David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 38/45] target-ppc: tlbie/tlbivax should have global effect David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 39/45] Enable H_CLEAR_MOD and H_CLEAR_REF hypercalls on KVM/PPC64 David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 40/45] ppc/xics: account correct irq status David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 41/45] ppc/xics: An ICS with offset 0 is assumed to be uninitialized David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 42/45] ppc/kvm: Mark 64kB page size support as disabled if not available David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 43/45] linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 44/45] monitor: fix crash for platforms without a CPU 0 David Gibson
2016-09-23  7:15 ` [Qemu-devel] [PULL 45/45] spapr_pci: Add numa node id David Gibson
2016-09-23  8:28 ` [Qemu-devel] [PULL 00/45] ppc-for-2.8 queue 20160923 no-reply
2016-09-23 14:27 ` Peter Maydell

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=1474614921-2221-11-git-send-email-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.