|
@@ -216,6 +216,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
|
|
}
|
|
}
|
|
numa_info[nodenr].present = true;
|
|
numa_info[nodenr].present = true;
|
|
max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);
|
|
max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);
|
|
|
|
+ nb_numa_nodes++;
|
|
}
|
|
}
|
|
|
|
|
|
static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
|
|
static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
|
|
@@ -282,7 +283,6 @@ static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
|
|
if (err) {
|
|
if (err) {
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
- nb_numa_nodes++;
|
|
|
|
break;
|
|
break;
|
|
case NUMA_OPTIONS_TYPE_DIST:
|
|
case NUMA_OPTIONS_TYPE_DIST:
|
|
parse_numa_distance(&object->u.dist, &err);
|
|
parse_numa_distance(&object->u.dist, &err);
|
|
@@ -433,6 +433,25 @@ void parse_numa_opts(MachineState *ms)
|
|
exit(1);
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * If memory hotplug is enabled (slots > 0) but without '-numa'
|
|
|
|
+ * options explicitly on CLI, guestes will break.
|
|
|
|
+ *
|
|
|
|
+ * Windows: won't enable memory hotplug without SRAT table at all
|
|
|
|
+ *
|
|
|
|
+ * Linux: if QEMU is started with initial memory all below 4Gb
|
|
|
|
+ * and no SRAT table present, guest kernel will use nommu DMA ops,
|
|
|
|
+ * which breaks 32bit hw drivers when memory is hotplugged and
|
|
|
|
+ * guest tries to use it with that drivers.
|
|
|
|
+ *
|
|
|
|
+ * Enable NUMA implicitly by adding a new NUMA node automatically.
|
|
|
|
+ */
|
|
|
|
+ if (ms->ram_slots > 0 && nb_numa_nodes == 0 &&
|
|
|
|
+ mc->auto_enable_numa_with_memhp) {
|
|
|
|
+ NumaNodeOptions node = { };
|
|
|
|
+ parse_numa_node(ms, &node, NULL);
|
|
|
|
+ }
|
|
|
|
+
|
|
assert(max_numa_nodeid <= MAX_NODES);
|
|
assert(max_numa_nodeid <= MAX_NODES);
|
|
|
|
|
|
/* No support for sparse NUMA node IDs yet: */
|
|
/* No support for sparse NUMA node IDs yet: */
|