From patchwork Fri Mar 18 09:13:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Reynal X-Patchwork-Id: 8617461 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0C5F3C0553 for ; Fri, 18 Mar 2016 09:19:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F8022035D for ; Fri, 18 Mar 2016 09:19:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EE1E2034B for ; Fri, 18 Mar 2016 09:19:21 +0000 (UTC) Received: from localhost ([::1]:42408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqYy-0003be-Kk for patchwork-qemu-devel@patchwork.kernel.org; Fri, 18 Mar 2016 05:19:20 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtualopensystems-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GPT8P2MmJBcRwsT7C0ge3PCQDw5S9FIaQDDumF/g+V8=; b=KI2ciX9CG9oi/42y663Flwnbs0S6flsX9J6uxaLws2jPhFWQ5XD+4CLAr2GCnlYcqz in9TpDyMoYnyg8IsMtz/Hf0syIXwxQWUuj5mtON/HxELTTK5wGJ+EldQnsxhgxnESTjF G2t2nnmwyGdUJk2WTUrV25rEV5XFj7bB8hTB68irhXIbnRAz8MBh5BSO/J9K+HueCY8L fHMJjbWTpNS6dYI6cS7k9jKQ46ub37IKBxfjeAai3VkH799TAzozLrU57dbDc0h7019S ghw/RIYZ9WqWqpwvm9d8q3/0iduodKjUuScaRvb8JFipbIF1MqS1JbxlR2Fc9laITZ/S gySw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GPT8P2MmJBcRwsT7C0ge3PCQDw5S9FIaQDDumF/g+V8=; b=cV+dbgj6kD4jTSKImLNiVpYQB91NWduMFNW9/RNDiuLc4IUA+77ZY+Zs8Ye4r2RcoS 0IzoGeO1SNBO/ud81knR+9bIudiFY1/l6eowwvsFEo92SoN6Y+NdPsVosHS5kv4hS3Fb WJJBi0nV4N1p+LBWWqQ3cl5REcbzvGsn09AhX4XeXMB+92BVpfoDaiStqjmD2A1AQRXk SOH9Cpo1HAJu1WsShljuqvh56ePrHc6paHLrJX5gu/TKThflBshzCDOa4FthxnysOm8a ZLYDVlK1N6nSZao5UvbTflRbZ+v/RZXm8SBQ9t0h4TJlndcOHW3VNMxKov3Ddci1bM/x t3ig== X-Gm-Message-State: AD7BkJIy4irWG6wZs8f0/jQWXxZTiUcT+sJEPe8nyNrHm3E6xzShxLMcg871owDWIBVeJQ== X-Received: by 10.28.22.74 with SMTP id 71mr15520400wmw.47.1458292456969; Fri, 18 Mar 2016 02:14:16 -0700 (PDT) Received: from localhost (LMontsouris-657-1-4-224.w90-63.abo.wanadoo.fr. [90.63.239.224]) by smtp.gmail.com with ESMTPSA id gg7sm11354867wjd.10.2016.03.18.02.14.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Mar 2016 02:14:16 -0700 (PDT) From: Baptiste Reynal To: qemu-devel@nongnu.org Date: Fri, 18 Mar 2016 10:13:55 +0100 Message-Id: <1458292438-13909-4-git-send-email-b.reynal@virtualopensystems.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1458292438-13909-1-git-send-email-b.reynal@virtualopensystems.com> References: <1458292438-13909-1-git-send-email-b.reynal@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::236 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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