From patchwork Thu May 2 13:35:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 240980 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 497B92C00BF for ; Thu, 2 May 2013 23:38:44 +1000 (EST) Received: from localhost ([::1]:43522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtic-0006In-4j for incoming@patchwork.ozlabs.org; Thu, 02 May 2013 09:38:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtgE-00030M-Vg for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXtg4-0004YD-Bp for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:14 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46630 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtg4-0004Wx-3Q for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:04 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D775EA55EB; Thu, 2 May 2013 15:36:02 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 2 May 2013 15:35:48 +0200 Message-Id: <1367501755-32272-23-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1367501755-32272-1-git-send-email-afaerber@suse.de> References: <1367501755-32272-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 22/29] QMP: Add cpu-add command 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 From: Igor Mammedov Adds "cpu-add id=xxx" QMP command. cpu-add's "id" argument is a CPU number in a range [0..max-cpus) Example QMP command: -> { "execute": "cpu-add", "arguments": { "id": 2 } } <- { "return": {} } Signed-off-by: Igor Mammedov Acked-by: Luiz Capitulino Reviewed-by: Eric Blake Reviewed-by: Eduardo Habkost Signed-off-by: Andreas Färber --- qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 23 +++++++++++++++++++++++ qmp.c | 10 ++++++++++ 3 files changed, 46 insertions(+) diff --git a/qapi-schema.json b/qapi-schema.json index 65be8f4..7797400 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1390,6 +1390,19 @@ { 'command': 'cpu', 'data': {'index': 'int'} } ## +# @cpu-add +# +# Adds CPU with specified ID +# +# @id: ID of CPU to be created, valid values [0..max_cpus) +# +# Returns: Nothing on success +# +# Since 1.5 +## +{ 'command': 'cpu-add', 'data': {'id': 'int'} } + +## # @memsave: # # Save a portion of guest memory to a file. diff --git a/qmp-commands.hx b/qmp-commands.hx index 0e89132..ed99eb8 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -385,6 +385,29 @@ Note: CPUs' indexes are obtained with the 'query-cpus' command. EQMP { + .name = "cpu-add", + .args_type = "id:i", + .mhandler.cmd_new = qmp_marshal_input_cpu_add, + }, + +SQMP +cpu-add +------- + +Adds virtual cpu + +Arguments: + +- "id": cpu id (json-int) + +Example: + +-> { "execute": "cpu-add", "arguments": { "id": 2 } } +<- { "return": {} } + +EQMP + + { .name = "memsave", .args_type = "val:l,size:i,filename:s,cpu:i?", .mhandler.cmd_new = qmp_marshal_input_memsave, diff --git a/qmp.c b/qmp.c index 4676993..4c149b3 100644 --- a/qmp.c +++ b/qmp.c @@ -24,6 +24,7 @@ #include "hw/qdev.h" #include "sysemu/blockdev.h" #include "qom/qom-qobject.h" +#include "hw/boards.h" NameInfo *qmp_query_name(Error **errp) { @@ -108,6 +109,15 @@ void qmp_cpu(int64_t index, Error **errp) /* Just do nothing */ } +void qmp_cpu_add(int64_t id, Error **errp) +{ + if (current_machine->hot_add_cpu) { + current_machine->hot_add_cpu(id, errp); + } else { + error_setg(errp, "Not supported"); + } +} + #ifndef CONFIG_VNC /* If VNC support is enabled, the "true" query-vnc command is defined in the VNC subsystem */