xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Xen Devel <xen-devel@lists.xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>
Subject: [PATCH 5/7] QMP: Add cpu-add command
Date: Mon, 17 Jun 2013 15:15:47 +0100	[thread overview]
Message-ID: <1371478549-28527-5-git-send-email-anthony.perard@citrix.com> (raw)
In-Reply-To: <1371478549-28527-1-git-send-email-anthony.perard@citrix.com>

From: Igor Mammedov <imammedo@redhat.com>

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 <imammedo@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>

(cherry picked from QEMU commit 69ca3ea5e192251f27510554611bcff6f036a00b)
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 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 5dfa052..64cecbe 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1284,6 +1284,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 5c692d0..88e097a 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 e3a7f0b..a904568 100644
--- a/qmp.c
+++ b/qmp.c
@@ -23,6 +23,7 @@
 #include "hw/qdev.h"
 #include "blockdev.h"
 #include "qemu/qom-qobject.h"
+#include "hw/boards.h"
 
 NameInfo *qmp_query_name(Error **errp)
 {
@@ -107,6 +108,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 */
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2013-06-17 14:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 14:13 [PATCH v2 0/7] CPU hotplug for qemu-xen for 4.3 Anthony PERARD
2013-06-17 14:15 ` [PATCH 1/7] cpu: Introduce get_arch_id() method and override it for X86CPU Anthony PERARD
2013-06-17 14:15   ` [PATCH 2/7] cpu: Add qemu_for_each_cpu() Anthony PERARD
2013-06-17 14:15   ` [PATCH 3/7] acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest Anthony PERARD
2013-06-17 14:15   ` [PATCH 4/7] Add hot_add_cpu hook to QEMUMachine Anthony PERARD
2013-06-17 14:15   ` Anthony PERARD [this message]
2013-06-17 14:15   ` [PATCH 6/7] xen: Fix vcpus initialisation Anthony PERARD
2013-06-20 11:14     ` Stefano Stabellini
2013-06-17 14:15   ` [PATCH 7/7] xen: Implement hot_add_cpu hook Anthony PERARD
2013-06-20 11:21     ` Stefano Stabellini
2013-06-20 13:19       ` Anthony PERARD
2013-06-20 13:40     ` Stefano Stabellini
2013-06-21 17:40       ` Anthony PERARD
2013-06-17 14:20 ` [PATCH v2 1/2] libxl: Add "cpu-add" QMP command Anthony PERARD
2013-06-17 14:20   ` [PATCH v2 2/2] libxl: Use QMP cpu-add to hotplug CPU with qemu-xen Anthony PERARD
2013-06-17 15:31     ` Ian Campbell
2013-06-17 15:50       ` Anthony PERARD
2013-06-20 11:12         ` Stefano Stabellini
2013-06-17 15:25   ` [PATCH v2 1/2] libxl: Add "cpu-add" QMP command Ian Campbell
2013-06-17 15:28     ` Anthony PERARD
2013-06-17 15:31       ` Ian Campbell
2013-06-17 14:22 ` [PATCH v2] xen: Allow CPU to be counted than currently "plugged" Anthony PERARD
2013-06-17 15:24   ` Ian Campbell
2013-06-17 15:44     ` Anthony PERARD
2013-06-24 16:57 ` [PATCH v2 0/7] CPU hotplug for qemu-xen for 4.3 Stefano Stabellini
2013-06-24 17:21   ` Stefano Stabellini
2013-06-24 17:28     ` Anthony PERARD
2013-06-25  9:19   ` George Dunlap
2013-06-25 11:40     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371478549-28527-5-git-send-email-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).