From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqU9-0003tl-B7 for qemu-devel@nongnu.org; Fri, 18 Mar 2016 05:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agqU5-0003xf-VE for qemu-devel@nongnu.org; Fri, 18 Mar 2016 05:14:21 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:33573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqU5-0003xI-E2 for qemu-devel@nongnu.org; Fri, 18 Mar 2016 05:14:17 -0400 Received: by mail-wm0-x236.google.com with SMTP id l68so59420317wml.0 for ; Fri, 18 Mar 2016 02:14:17 -0700 (PDT) From: Baptiste Reynal Date: Fri, 18 Mar 2016 10:13:55 +0100 Message-Id: <1458292438-13909-4-git-send-email-b.reynal@virtualopensystems.com> In-Reply-To: <1458292438-13909-1-git-send-email-b.reynal@virtualopensystems.com> References: <1458292438-13909-1-git-send-email-b.reynal@virtualopensystems.com> Subject: [Qemu-devel] [RFC v2 3/6] hw/misc: sdm signal shboot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: b.reynal@virtualopensystems.com, Jani.Kokkonen@huawei.com, tech@virtualopensystems.com, Claudio.Fontana@huawei.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 --- 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 + * + * 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 + * + * 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