qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC v2 3/6] hw/misc: sdm signal shboot


From: Baptiste Reynal
Subject: [Qemu-devel] [RFC v2 3/6] hw/misc: sdm signal shboot
Date: Fri, 18 Mar 2016 10:13:55 +0100

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 <address@hidden>
---
 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 <address@hidden>
+ *
+ * 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 <address@hidden>
+ *
+ * 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]