From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8tcI-0002Zc-2R for qemu-devel@nongnu.org; Thu, 11 May 2017 15:19:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8tcH-0007qp-1M for qemu-devel@nongnu.org; Thu, 11 May 2017 15:19:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47292) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8tcG-0007qE-R8 for qemu-devel@nongnu.org; Thu, 11 May 2017 15:19:12 -0400 From: Eduardo Habkost Date: Thu, 11 May 2017 16:18:27 -0300 Message-Id: <20170511191843.13784-14-ehabkost@redhat.com> In-Reply-To: <20170511191843.13784-1-ehabkost@redhat.com> References: <20170511191843.13784-1-ehabkost@redhat.com> Subject: [Qemu-devel] [PULL 13/29] numa: add check that board supports cpu_index to node mapping List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, Igor Mammedov From: Igor Mammedov 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 Reviewed-by: Andrew Jones Reviewed-by: David Gibson Message-Id: <1494415802-227633-6-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- numa.c | 13 ++++++++++--- 1 file 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); } -- 2.11.0.259.g40922b1