aboutsummaryrefslogtreecommitdiff
path: root/hw/core/numa.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core/numa.c')
-rw-r--r--hw/core/numa.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 2725886d06..6a20ce7cf1 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -688,8 +688,9 @@ void numa_complete_configuration(MachineState *ms)
NodeInfo *numa_info = ms->numa_state->nodes;
/*
- * If memory hotplug is enabled (slots > 0) but without '-numa'
- * options explicitly on CLI, guestes will break.
+ * If memory hotplug is enabled (slot > 0) or memory devices are enabled
+ * (ms->maxram_size > ram_size) but without '-numa' options explicitly on
+ * CLI, guests will break.
*
* Windows: won't enable memory hotplug without SRAT table at all
*
@@ -704,9 +705,9 @@ void numa_complete_configuration(MachineState *ms)
* assume there is just one node with whole RAM.
*/
if (ms->numa_state->num_nodes == 0 &&
- ((ms->ram_slots > 0 &&
- mc->auto_enable_numa_with_memhp) ||
- mc->auto_enable_numa)) {
+ ((ms->ram_slots && mc->auto_enable_numa_with_memhp) ||
+ (ms->maxram_size > ms->ram_size && mc->auto_enable_numa_with_memdev) ||
+ mc->auto_enable_numa)) {
NumaNodeOptions node = { };
parse_numa_node(ms, &node, &error_abort);
numa_info[0].node_mem = ram_size;
@@ -824,6 +825,7 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[])
MemoryDeviceInfoList *info;
PCDIMMDeviceInfo *pcdimm_info;
VirtioPMEMDeviceInfo *vpi;
+ VirtioMEMDeviceInfo *vmi;
for (info = info_list; info; info = info->next) {
MemoryDeviceInfo *value = info->value;
@@ -844,6 +846,11 @@ static void numa_stat_memory_devices(NumaNodeMem node_mem[])
node_mem[0].node_mem += vpi->size;
node_mem[0].node_plugged_mem += vpi->size;
break;
+ case MEMORY_DEVICE_INFO_KIND_VIRTIO_MEM:
+ vmi = value->u.virtio_mem.data;
+ node_mem[vmi->node].node_mem += vmi->size;
+ node_mem[vmi->node].node_plugged_mem += vmi->size;
+ break;
default:
g_assert_not_reached();
}