From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 2 May 2013 15:35:48 +0200 Message-Id: <1367501755-32272-23-git-send-email-afaerber@suse.de> 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 22/29] QMP: Add cpu-add command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Igor Mammedov Adds "cpu-add id=3Dxxx" 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=C3=A4rber --- 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'} } =20 ## +# @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-cpu= s' command. EQMP =20 { + .name =3D "cpu-add", + .args_type =3D "id:i", + .mhandler.cmd_new =3D 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 =3D "memsave", .args_type =3D "val:l,size:i,filename:s,cpu:i?", .mhandler.cmd_new =3D 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" =20 NameInfo *qmp_query_name(Error **errp) { @@ -108,6 +109,15 @@ void qmp_cpu(int64_t index, Error **errp) /* Just do nothing */ } =20 +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 */ --=20 1.8.1.4