qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Baptiste Reynal <b.reynal@virtualopensystems.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Jani.Kokkonen@huawei.com,
	tech@virtualopensystems.com, Claudio.Fontana@huawei.com,
	b.reynal@virtualopensystems.com
Subject: [Qemu-devel] [RFC 4/4] hw/misc: sdm signal nboot
Date: Thu, 24 Mar 2016 14:16:42 +0100	[thread overview]
Message-ID: <1458825402-9592-5-git-send-email-b.reynal@virtualopensystems.com> (raw)
In-Reply-To: <1458825402-9592-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 network memory.

Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
---
 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 <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-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 <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.
+ */
+#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

      parent reply	other threads:[~2016-03-24 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 13:16 [Qemu-devel] [RFC 0/4] QEMU shared-memory over network Baptiste Reynal
2016-03-24 13:16 ` [Qemu-devel] [RFC 1/4] backend: multi-client-socket Baptiste Reynal
2016-03-24 13:16 ` [Qemu-devel] [RFC 2/4] backend: shared memory over network backend Baptiste Reynal
2016-03-24 13:16 ` [Qemu-devel] [RFC 3/4] migration: extend shared migration type Baptiste Reynal
2016-03-24 13:16 ` Baptiste Reynal [this message]

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=1458825402-9592-5-git-send-email-b.reynal@virtualopensystems.com \
    --to=b.reynal@virtualopensystems.com \
    --cc=Claudio.Fontana@huawei.com \
    --cc=Jani.Kokkonen@huawei.com \
    --cc=pbonzini@redhat.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).