qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC 4/4] hw/misc: sdm signal nboot


From: Baptiste Reynal
Subject: [Qemu-devel] [RFC 4/4] hw/misc: sdm signal nboot
Date: Thu, 24 Mar 2016 14:16:42 +0100

This patch introduces a new signal for SDM device, which triggers the
boot of a machine using a network memory.

Signed-off-by: Baptiste Reynal <address@hidden>
---
 hw/misc/Makefile.objs              |  1 +
 hw/misc/sdm-signal-nboot.c         | 62 ++++++++++++++++++++++++++++++++++++++
 include/hw/misc/sdm-signal-nboot.h | 28 +++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 hw/misc/sdm-signal-nboot.c
 create mode 100644 include/hw/misc/sdm-signal-nboot.h

diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 20a7d82..12d955e 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -28,6 +28,7 @@ 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_SDM) += sdm-signal-nboot.o
 
 obj-$(CONFIG_REALVIEW) += arm_sysctl.o
 obj-$(CONFIG_NSERIES) += cbus.o
diff --git a/hw/misc/sdm-signal-nboot.c b/hw/misc/sdm-signal-nboot.c
new file mode 100644
index 0000000..c04d1b4
--- /dev/null
+++ b/hw/misc/sdm-signal-nboot.c
@@ -0,0 +1,62 @@
+/*
+ * SDM Signal network 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-nboot.h"
+
+static int sdm_signal_nboot_hw_ops(SDMSignal *signal, SDMSignalData *data)
+{
+    SDMSignalNBoot *snb = SDM_SIGNAL_NBOOT(signal);
+    HostMemoryBackendNetworkClass *nhmc =
+        MEMORY_BACKEND_NETWORK_GET_CLASS(snb->nhm);
+
+    nhmc->boot(snb->nhm);
+
+    return 0;
+}
+
+static bool sdm_signal_nboot_hw_only(SDMSignal *signal)
+{
+    return true;
+}
+
+static void sdm_signal_nboot_init(Object *obj)
+{
+    SDMSignalNBoot *signal = SDM_SIGNAL_NBOOT(obj);
+
+    object_property_add_link(obj, "nhm",
+            TYPE_MEMORY_BACKEND_NETWORK,
+            (Object **)&signal->nhm,
+            object_property_allow_set_link,
+            OBJ_PROP_LINK_UNREF_ON_RELEASE,
+            &error_abort);
+}
+
+static void sdm_signal_nboot_class_init(ObjectClass *oc, void *data)
+{
+    SDMSignalClass *signalc = SDM_SIGNAL_CLASS(oc);
+
+    signalc->hw_ops = sdm_signal_nboot_hw_ops;
+    signalc->hw_only = sdm_signal_nboot_hw_only;
+}
+
+static const TypeInfo sdm_signal_nboot_info = {
+    .name = TYPE_SDM_SIGNAL_NBOOT,
+    .parent = TYPE_SDM_SIGNAL,
+    .class_init = sdm_signal_nboot_class_init,
+    .instance_size = sizeof(SDMSignalNBoot),
+    .instance_init = sdm_signal_nboot_init,
+};
+
+static void register_types(void)
+{
+    type_register_static(&sdm_signal_nboot_info);
+}
+
+type_init(register_types);
diff --git a/include/hw/misc/sdm-signal-nboot.h 
b/include/hw/misc/sdm-signal-nboot.h
new file mode 100644
index 0000000..a56ce44
--- /dev/null
+++ b/include/hw/misc/sdm-signal-nboot.h
@@ -0,0 +1,28 @@
+/*
+ * SDM Signal network 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.
+ */
+#ifndef HW_SDM_SIGNAL_NBOOT_H
+#define HW_SDM_SIGNAL_NBOOT_H
+
+#include "hw/misc/sdm-signal.h"
+#include "sysemu/hostmem-network.h"
+
+#define TYPE_SDM_SIGNAL_NBOOT "sdm-signal-nboot"
+#define SDM_SIGNAL_NBOOT(obj) \
+    OBJECT_CHECK(SDMSignalNBoot, (obj), TYPE_SDM_SIGNAL)
+
+typedef struct SDMSignalNBoot SDMSignalNBoot;
+
+struct SDMSignalNBoot {
+    SDMSignal parent;
+
+    HostMemoryBackendNetwork *nhm;
+};
+#endif
-- 
2.7.4




reply via email to

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