From patchwork Fri Mar 18 09:13:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Reynal X-Patchwork-Id: 8617481 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 9364BC0553 for ; Fri, 18 Mar 2016 09:21:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE5002037F for ; Fri, 18 Mar 2016 09:21:50 +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 7551F20377 for ; Fri, 18 Mar 2016 09:21:46 +0000 (UTC) Received: from localhost ([::1]:42439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqbJ-0007dO-K9 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 18 Mar 2016 05:21:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqUE-00043v-Q5 for qemu-devel@nongnu.org; Fri, 18 Mar 2016 05:14:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agqUA-0003zN-N3 for qemu-devel@nongnu.org; Fri, 18 Mar 2016 05:14:26 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:36040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agqUA-0003z7-D1 for qemu-devel@nongnu.org; Fri, 18 Mar 2016 05:14:22 -0400 Received: by mail-wm0-x229.google.com with SMTP id l124so22973930wmf.1 for ; Fri, 18 Mar 2016 02:14:22 -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=enahy3N4tVYKEggP/b52mAKmohOkOSXqOCRFmz0c1/o=; b=I5Q4K+4lqkx5LKKKDCu04Sd5tmFO5KDu5tZjkpRGBpQBQrUh33Ijw/0SaxkLbo48VU beEC0/X8a//8G3/3GhFHsANUdtOHfs7vSkur64Q+iQ4BGaJFsbhlArCPLCbtIJNbYQVN ax0JNHWJA7vMHBYZNajF2UEs+0T4J/74ajwb37Qs3hoXk4+bHSeV5MsSDAy0J1Zf4sn7 tYctcEty5RehS+QcA15LOepgkTzECOG6oRvN7c2UqDki53Sgu/Q1l9xCLVXj4bgmxLe5 g1v0+j4l+g19zVt+x3tXYzbpxpvbrrfS4qvnha7RjuQnK4REJv++/sPcXIHEjilMmPtN Lvew== 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=enahy3N4tVYKEggP/b52mAKmohOkOSXqOCRFmz0c1/o=; b=j1BJa05FaHFBvnr0E/a5FzLy+OgDXkLDeivQ9/5UfZh7djIw4NTgfkLaJ+eeQqFFyQ hzoL9pxCYftCmslwCKy0PfLH2yioGtqlMEHqTxfDupUTTp4AKmEUDWHOUt/F6klyi8v1 Et12kybY7n/Tx16vr6r0epi+blV+tqnx9/BtZzcdJMlRisk/TKhmPfWkMrOL4IGlS82s VJd1KnRFBTKrKb+Mds79AvV7+/oLcY9a5n/f90k634BPzL2dr3w0s8xaJLiFCcKeZ+RD Z/ruoUaWT1bjppAOocXS/y98lDf5Btn8lVrvOq9ssB7YbV+mvr+fe80h0CxGH62dDkqO oroQ== X-Gm-Message-State: AD7BkJKn2kLwxrgiHmUMVJgZGrYDNOlZvb2G12QV9lh15psSE6XHbf58/kc7Uqlhs0UoHA== X-Received: by 10.194.60.145 with SMTP id h17mr15651980wjr.47.1458292461912; Fri, 18 Mar 2016 02:14:21 -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 l135sm11815177wmb.13.2016.03.18.02.14.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Mar 2016 02:14:21 -0700 (PDT) From: Baptiste Reynal To: qemu-devel@nongnu.org Date: Fri, 18 Mar 2016 10:13:56 +0100 Message-Id: <1458292438-13909-5-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::229 Cc: b.reynal@virtualopensystems.com, Jani.Kokkonen@huawei.com, tech@virtualopensystems.com, Claudio.Fontana@huawei.com, Christian Pinto Subject: [Qemu-devel] [RFC v2 4/6] qemu: slave machine flag 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 From: Christian Pinto This patch adds a new machine flag, to configure qemu as a slave instance. Usage -machine -slave=[on|off] (default=off) Signed-off-by: Christian Pinto --- hw/core/machine.c | 27 +++++++++++++++++++++++++++ include/hw/boards.h | 2 ++ qemu-options.hx | 5 ++++- util/qemu-config.c | 5 +++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index f4db340..b3e1e28 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -283,6 +283,20 @@ static bool machine_get_suppress_vmdesc(Object *obj, Error **errp) return ms->suppress_vmdesc; } +static bool machine_get_slave(Object *obj, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + return ms->slave; +} + +static void machine_set_slave(Object *obj, bool value, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + ms->slave = value; +} + static int error_on_sysbus_device(SysBusDevice *sbdev, void *opaque) { error_report("Option '-device %s' cannot be handled by this machine", @@ -335,6 +349,7 @@ static void machine_initfn(Object *obj) ms->kvm_shadow_mem = -1; ms->dump_guest_core = true; ms->mem_merge = true; + ms->slave = false; object_property_add_str(obj, "accel", machine_get_accel, machine_set_accel, NULL); @@ -437,6 +452,13 @@ static void machine_initfn(Object *obj) object_property_set_description(obj, "suppress-vmdesc", "Set on to disable self-describing migration", NULL); + object_property_add_bool(obj, "slave", + machine_get_slave, + machine_set_slave, + NULL); + object_property_set_description(obj, "slave", + "Enables a slave (remote) machine instance", + NULL); /* Register notifier when init is done for sysbus sanity checks */ ms->sysbus_notifier.notify = machine_init_notify; @@ -497,6 +519,11 @@ bool machine_mem_merge(MachineState *machine) return machine->mem_merge; } +bool machine_slave(MachineState *machine) +{ + return machine->slave; +} + static const TypeInfo machine_info = { .name = TYPE_MACHINE, .parent = TYPE_OBJECT, diff --git a/include/hw/boards.h b/include/hw/boards.h index 3e9a92c..523cfc2 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -40,6 +40,7 @@ int machine_kvm_shadow_mem(MachineState *machine); int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); +bool machine_slave(MachineState *machine); /** * MachineClass: @@ -120,6 +121,7 @@ struct MachineState { char *firmware; bool iommu; bool suppress_vmdesc; + bool slave; ram_addr_t ram_size; ram_addr_t maxram_size; diff --git a/qemu-options.hx b/qemu-options.hx index 7e147b8..96300ba 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -41,7 +41,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " igd-passthru=on|off controls IGD GFX passthrough support (default=off)\n" " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n" " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n" - " suppress-vmdesc=on|off disables self-describing migration (default=off)\n", + " suppress-vmdesc=on|off disables self-describing migration (default=off)\n" + " slave=on|off enables a slave (remote) machine instance (default=off)", QEMU_ARCH_ALL) STEXI @item -machine [type=]@var{name}[,prop=@var{value}[,...]] @@ -80,6 +81,8 @@ execution of AES cryptographic functions. The default is on. Enables or disables DEA key wrapping support on s390-ccw hosts. This feature controls whether DEA wrapping keys will be created to allow execution of DEA cryptographic functions. The default is on. +@item slave=on|off +Enables a slave (remote) machine instance @end table ETEXI diff --git a/util/qemu-config.c b/util/qemu-config.c index 5fcfd0e..696408d 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -219,6 +219,11 @@ static QemuOptsList machine_opts = { .name = "suppress-vmdesc", .type = QEMU_OPT_BOOL, .help = "Set on to disable self-describing migration", + },{ + .name = "slave", + .type = QEMU_OPT_BOOL, + .help = "Indicates the machine is a slave instance " + "(e.g. remoteproc)", }, { /* End of list */ } }