aboutsummaryrefslogtreecommitdiff
path: root/numa.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-05-10 13:29:49 +0200
committerEduardo Habkost <ehabkost@redhat.com>2017-05-11 16:08:49 -0300
commit64c2a8f6d3facc2f758907c3b95686fe9e999590 (patch)
tree17602dd3ff11ff25d790e0d22b05b0e972fe2e61 /numa.c
parentbd4c1bfe3e2736e5bb3e5238ede718843b175cc6 (diff)
numa: add check that board supports cpu_index to node mapping
Default node mapping initialization already checks that board supports cpu_index to node mapping and refuses to start if it's not supported. Do the same for explicitly provided mapping "-numa node,cpus=..." Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <1494415802-227633-6-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'numa.c')
-rw-r--r--numa.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/numa.c b/numa.c
index bcdfca2309..718248161c 100644
--- a/numa.c
+++ b/numa.c
@@ -141,10 +141,12 @@ uint32_t numa_get_node(ram_addr_t addr, Error **errp)
return -1;
}
-static void parse_numa_node(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
+static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
+ QemuOpts *opts, Error **errp)
{
uint16_t nodenr;
uint16List *cpus = NULL;
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
if (node->has_nodeid) {
nodenr = node->nodeid;
@@ -163,6 +165,10 @@ static void parse_numa_node(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
return;
}
+ if (!mc->cpu_index_to_instance_props) {
+ error_report("NUMA is not supported by this machine-type");
+ exit(1);
+ }
for (cpus = node->cpus; cpus; cpus = cpus->next) {
if (cpus->value >= max_cpus) {
error_setg(errp,
@@ -253,6 +259,7 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
{
NumaOptions *object = NULL;
+ MachineState *ms = opaque;
Error *err = NULL;
{
@@ -267,7 +274,7 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
switch (object->type) {
case NUMA_OPTIONS_TYPE_NODE:
- parse_numa_node(&object->u.node, opts, &err);
+ parse_numa_node(ms, &object->u.node, opts, &err);
if (err) {
goto end;
}
@@ -452,7 +459,7 @@ void parse_numa_opts(MachineState *ms)
numa_info[i].node_cpu = bitmap_new(max_cpus);
}
- if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, NULL)) {
+ if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) {
exit(1);
}