aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2019-07-02 10:07:44 -0400
committerEduardo Habkost <ehabkost@redhat.com>2019-07-05 17:12:45 -0300
commitb69239e085b00c8f29475421ade5295c13417ed4 (patch)
tree9c4ba28ea930d43172c8ca3adca847873cf07edb /hw/core
parentf8123f2275d27c44fe523b36a039ca4739e5bbfe (diff)
downloadqemu-b69239e085b00c8f29475421ade5295c13417ed4.zip
qemu-b69239e085b00c8f29475421ade5295c13417ed4.tar.gz
qemu-b69239e085b00c8f29475421ade5295c13417ed4.tar.bz2
numa: allow memory-less nodes when using memdev as backend
QEMU fails to start if memory-less node is present when memdev is used qemu-system-x86_64 -object memory-backend-ram,id=ram0,size=128M \ -numa node -numa node,memdev=ram0 with error: "memdev option must be specified for either all or no nodes" which works as expected if legacy 'mem' is used. Fix check to make memory-less nodes valid when memdev option is used but still disallow mix of mem and memdev options. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20190702140745.27767-2-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/numa.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 2d984b0..a114314 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -45,7 +45,8 @@ QemuOptsList qemu_numa_opts = {
.desc = { { 0 } } /* validated with OptsVisitor */
};
-static int have_memdevs = -1;
+static int have_memdevs;
+static int have_mem;
static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
* For all nodes, nodeid < max_numa_nodeid
*/
@@ -103,17 +104,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
}
}
- if (node->has_mem && node->has_memdev) {
- error_setg(errp, "cannot specify both mem= and memdev=");
- return;
- }
-
- if (have_memdevs == -1) {
- have_memdevs = node->has_memdev;
- }
- if (node->has_memdev != have_memdevs) {
- error_setg(errp, "memdev option must be specified for either "
- "all or no nodes");
+ have_memdevs = have_memdevs ? : node->has_memdev;
+ have_mem = have_mem ? : node->has_mem;
+ if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {
+ error_setg(errp, "numa configuration should use either mem= or memdev=,"
+ "mixing both is not allowed");
return;
}