From: Baptiste Reynal <b.reynal@virtualopensystems.com>
To: qemu-devel@nongnu.org
Cc: b.reynal@virtualopensystems.com, Jani.Kokkonen@huawei.com,
tech@virtualopensystems.com, Claudio.Fontana@huawei.com
Subject: [Qemu-devel] [RFC v2 3/6] hw/misc: sdm signal shboot
Date: Fri, 18 Mar 2016 10:13:55 +0100 [thread overview]
Message-ID: <1458292438-13909-4-git-send-email-b.reynal@virtualopensystems.com> (raw)
In-Reply-To: <1458292438-13909-1-git-send-email-b.reynal@virtualopensystems.com>
This patch introduces a new signal for SDM device, which triggers the
boot of a machine using a shared memory.
Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
---
hw/misc/Makefile.objs | 1 +
hw/misc/sdm-signal-shboot.c | 62 +++++++++++++++++++++++++++++++++++++
include/hw/misc/sdm-signal-shboot.h | 38 +++++++++++++++++++++++
3 files changed, 101 insertions(+)
create mode 100644 hw/misc/sdm-signal-shboot.c
create mode 100644 include/hw/misc/sdm-signal-shboot.h
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index b9f75db..20a7d82 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -27,6 +27,7 @@ obj-$(CONFIG_SDM) += sdm-signal.o
obj-$(CONFIG_SDM) += sdm-platform.o
obj-$(CONFIG_SDM) += sdm-communication-local.o
obj-$(CONFIG_SDM) += sdm-communication-socket.o
+obj-$(CONFIG_SDM) += sdm-signal-shboot.o
obj-$(CONFIG_REALVIEW) += arm_sysctl.o
obj-$(CONFIG_NSERIES) += cbus.o
diff --git a/hw/misc/sdm-signal-shboot.c b/hw/misc/sdm-signal-shboot.c
new file mode 100644
index 0000000..4664e31
--- /dev/null
+++ b/hw/misc/sdm-signal-shboot.c
@@ -0,0 +1,62 @@
+/*
+ * SDM Signal Shared Boot
+ *
+ * Copyright (C) 2016 - Virtual Open Systems
+ *
+ * Author: Baptiste Reynal <b.reynalb@virtualopensystems.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+#include "hw/misc/sdm-signal-shboot.h"
+
+static int sdm_signal_shboot_hw_ops(SDMSignal *signal, SDMSignalData *data)
+{
+ SDMSignalShBoot *shb = SDM_SIGNAL_SHBOOT(signal);
+ HostMemoryBackendSharedClass *shmc =
+ MEMORY_BACKEND_SHARED_GET_CLASS(shb->shm);
+
+ shmc->map(shb->shm, data->payload[0], data->payload[1]);
+
+ return 0;
+}
+
+static bool sdm_signal_shboot_hw_only(SDMSignal *signal)
+{
+ return true;
+}
+
+static void sdm_signal_shboot_init(Object *obj)
+{
+ SDMSignalShBoot *signal = SDM_SIGNAL_SHBOOT(obj);
+
+ object_property_add_link(obj, "shm",
+ TYPE_MEMORY_BACKEND_SHARED,
+ (Object **)&signal->shm,
+ object_property_allow_set_link,
+ OBJ_PROP_LINK_UNREF_ON_RELEASE,
+ &error_abort);
+}
+
+static void sdm_signal_shboot_class_init(ObjectClass *oc, void *data)
+{
+ SDMSignalClass *signalc = SDM_SIGNAL_CLASS(oc);
+
+ signalc->hw_ops = sdm_signal_shboot_hw_ops;
+ signalc->hw_only = sdm_signal_shboot_hw_only;
+}
+
+static const TypeInfo sdm_signal_shboot_info = {
+ .name = TYPE_SDM_SIGNAL_SHBOOT,
+ .parent = TYPE_SDM_SIGNAL,
+ .class_init = sdm_signal_shboot_class_init,
+ .instance_size = sizeof(SDMSignalShBoot),
+ .instance_init = sdm_signal_shboot_init,
+};
+
+static void register_types(void)
+{
+ type_register_static(&sdm_signal_shboot_info);
+}
+
+type_init(register_types);
diff --git a/include/hw/misc/sdm-signal-shboot.h b/include/hw/misc/sdm-signal-shboot.h
new file mode 100644
index 0000000..37fd58b
--- /dev/null
+++ b/include/hw/misc/sdm-signal-shboot.h
@@ -0,0 +1,38 @@
+/*
+ * SDM Signal Shared Boot
+ *
+ * Copyright (C) 2016 - Virtual Open Systems
+ *
+ * Author: Baptiste Reynal <b.reynal@virtualopensystems.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ * This signal triggers the boot of a shared memory backend. It is intended to
+ * find the size in PAYLOAD_REG0 and the offset in PAYLOAD_REG1.
+ */
+#ifndef HW_SDM_SIGNAL_SHBOOT_H
+#define HW_SDM_SIGNAL_SHBOOT_H
+
+#include "hw/misc/sdm-signal.h"
+#include "sysemu/hostmem-shared.h"
+
+#define TYPE_SDM_SIGNAL_SHBOOT "sdm-signal-shboot"
+#define SDM_SIGNAL_SHBOOT(obj) \
+ OBJECT_CHECK(SDMSignalShBoot, (obj), TYPE_SDM_SIGNAL)
+
+typedef struct SDMSignalShBoot SDMSignalShBoot;
+
+/**
+ *
+ * @SDMSignalShBoot
+ *
+ * @parent: opaque parent object container
+ */
+struct SDMSignalShBoot {
+ /* private */
+ SDMSignal parent;
+
+ HostMemoryBackendShared *shm;
+};
+#endif
--
2.7.3
next prev parent reply other threads:[~2016-03-18 9:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-18 9:13 [Qemu-devel] [RFC v2 0/6] QEMU shared-memory backend Baptiste Reynal
2016-03-18 9:13 ` [Qemu-devel] [RFC v2 1/6] backend: shared memory backend Baptiste Reynal
2016-03-18 9:13 ` [Qemu-devel] [RFC v2 2/6] migration: add shared migration type Baptiste Reynal
2016-03-18 9:13 ` Baptiste Reynal [this message]
2016-03-18 9:13 ` [Qemu-devel] [RFC v2 4/6] qemu: slave machine flag Baptiste Reynal
2016-03-18 9:13 ` [Qemu-devel] [RFC v2 5/6] hw/arm: boot Baptiste Reynal
2016-03-18 9:13 ` [Qemu-devel] [RFC v2 6/6] qemu: numa Baptiste Reynal
2016-03-22 14:14 ` [Qemu-devel] [RFC v2 0/6] QEMU shared-memory backend Markus Armbruster
2016-03-22 14:54 ` Baptiste Reynal
2016-04-07 16:27 ` Markus Armbruster
2016-04-08 12:52 ` Baptiste Reynal
2016-04-08 13:59 ` Markus Armbruster
2016-03-31 9:14 ` Stefan Hajnoczi
2016-04-05 12:00 ` Baptiste Reynal
2016-04-06 8:57 ` Stefan Hajnoczi
2016-04-06 13:47 ` Igor Mammedov
2016-04-08 12:46 ` Baptiste Reynal
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=1458292438-13909-4-git-send-email-b.reynal@virtualopensystems.com \
--to=b.reynal@virtualopensystems.com \
--cc=Claudio.Fontana@huawei.com \
--cc=Jani.Kokkonen@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=tech@virtualopensystems.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).