Skip to content

Commit 69ca3ea

Browse files
Igor Mammedovafaerber
Igor Mammedov
authored andcommittedMay 1, 2013
QMP: Add cpu-add command
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 <[email protected]> Acked-by: Luiz Capitulino <[email protected]> Reviewed-by: Eric Blake <[email protected]> Reviewed-by: Eduardo Habkost <[email protected]> Signed-off-by: Andreas Färber <[email protected]>
1 parent b4fc7b4 commit 69ca3ea

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
 

‎qapi-schema.json

+13
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,19 @@
13891389
##
13901390
{ 'command': 'cpu', 'data': {'index': 'int'} }
13911391

1392+
##
1393+
# @cpu-add
1394+
#
1395+
# Adds CPU with specified ID
1396+
#
1397+
# @id: ID of CPU to be created, valid values [0..max_cpus)
1398+
#
1399+
# Returns: Nothing on success
1400+
#
1401+
# Since 1.5
1402+
##
1403+
{ 'command': 'cpu-add', 'data': {'id': 'int'} }
1404+
13921405
##
13931406
# @memsave:
13941407
#

‎qmp-commands.hx

+23
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,29 @@ Example:
382382

383383
Note: CPUs' indexes are obtained with the 'query-cpus' command.
384384

385+
EQMP
386+
387+
{
388+
.name = "cpu-add",
389+
.args_type = "id:i",
390+
.mhandler.cmd_new = qmp_marshal_input_cpu_add,
391+
},
392+
393+
SQMP
394+
cpu-add
395+
-------
396+
397+
Adds virtual cpu
398+
399+
Arguments:
400+
401+
- "id": cpu id (json-int)
402+
403+
Example:
404+
405+
-> { "execute": "cpu-add", "arguments": { "id": 2 } }
406+
<- { "return": {} }
407+
385408
EQMP
386409

387410
{

‎qmp.c

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "hw/qdev.h"
2525
#include "sysemu/blockdev.h"
2626
#include "qom/qom-qobject.h"
27+
#include "hw/boards.h"
2728

2829
NameInfo *qmp_query_name(Error **errp)
2930
{
@@ -108,6 +109,15 @@ void qmp_cpu(int64_t index, Error **errp)
108109
/* Just do nothing */
109110
}
110111

112+
void qmp_cpu_add(int64_t id, Error **errp)
113+
{
114+
if (current_machine->hot_add_cpu) {
115+
current_machine->hot_add_cpu(id, errp);
116+
} else {
117+
error_setg(errp, "Not supported");
118+
}
119+
}
120+
111121
#ifndef CONFIG_VNC
112122
/* If VNC support is enabled, the "true" query-vnc command is
113123
defined in the VNC subsystem */

0 commit comments

Comments
 (0)
Please sign in to comment.