From patchwork Thu Mar 24 13:16:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Reynal X-Patchwork-Id: 601577 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3qW6X25jF8z9sB6 for ; Fri, 25 Mar 2016 00:21:22 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=virtualopensystems-com.20150623.gappssmtp.com header.i=@virtualopensystems-com.20150623.gappssmtp.com header.b=YD9GZN0J; dkim-atps=neutral Received: from localhost ([::1]:50274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj5CT-0006KV-0O for incoming@patchwork.ozlabs.org; Thu, 24 Mar 2016 09:21:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj59e-0001oD-9x for qemu-devel@nongnu.org; Thu, 24 Mar 2016 09:18:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj59Z-000576-KE for qemu-devel@nongnu.org; Thu, 24 Mar 2016 09:18:26 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj59Z-000570-9V for qemu-devel@nongnu.org; Thu, 24 Mar 2016 09:18:21 -0400 Received: by mail-wm0-x243.google.com with SMTP id l68so12175215wml.3 for ; Thu, 24 Mar 2016 06:18:21 -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=qX/+Sg89CUevBVKLjRpRmr5oST2W6ZsNkrJnaDjX1Tw=; b=YD9GZN0JPsfv+sCZ8xHy3P9SWhU4WFVHCCHgrHdMQIUmgwO2uODaU2VwImotDgYR7/ E1Ai6ra9thuai9ZMiMJJEReFSMM8z9PgFScgAiVOujfR8Zj9rqHF+woo0aC9GZVTVPq1 r1+jB4HzkZ1NrayjSdSdoad9JttQmtw3XcLj/ThFIlru4q9bssMTdTqOXPFKMsXrF9o9 rbvnVy3aGDa9TqwrZn7O2UUAIWJ0yZNeGPohhVoAP/eJtiN5CzKh1iSqv2PJthWGgsou PAZenDGzjdPLyFZ+COa54pTgXko66NsfatUC61RSb2DjEmseIqQfkjI5t3clVB2NafU1 M8JQ== 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=qX/+Sg89CUevBVKLjRpRmr5oST2W6ZsNkrJnaDjX1Tw=; b=ZhwjMXxSqo1dTTUTT55lhSWWvsgA7DLfzbCK+z+ICo8w24OfOEttCW6cnU8LxR0Z4O l5xk2Kp65MD0pSLl2bcnpMMp2erjaryWZ7HnF9VadLGhzxNDOtXruqCTOMQ14ukCxtm+ sxfUZemRFSM5P3HQFoXCSgyetGGSZIZEbPRr3Spxvkjxwl44O5iFX5BoqL5JkVOmCANO j8TdERHi26zKFbfbjxD8b3W5eD/o2mFNQQAYje8JGzRzvoqteYYXZDMARgFE597AZ1zL /8msA9VsZxUJhuqhdoVXfHydDylxcugAvWaq2Wk0EZIl3IWMySBXVqLDg8D8xj8qjPyz AyXg== X-Gm-Message-State: AD7BkJLnAV4WVO2RBeOBpexIRvoR++KHf0ocXEGRIY1dCg3ZV+xx8YyI9lCpzlFG+ONwxQ== X-Received: by 10.194.116.9 with SMTP id js9mr11278291wjb.112.1458825500697; Thu, 24 Mar 2016 06:18:20 -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 t7sm7354341wjf.39.2016.03.24.06.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Mar 2016 06:18:20 -0700 (PDT) From: Baptiste Reynal To: qemu-devel@nongnu.org Date: Thu, 24 Mar 2016 14:16:42 +0100 Message-Id: <1458825402-9592-5-git-send-email-b.reynal@virtualopensystems.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1458825402-9592-1-git-send-email-b.reynal@virtualopensystems.com> References: <1458825402-9592-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::243 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 + * + * 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 + * + * 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