Put the 0-640KiB range in the first node with memory. This also prevents mem_len to underflow when node 0 size is 0. Tested with Linux.
Signed-off-by: Thadeu Lima de Souza Cascardo <casca...@redhat.com> --- hw/i386/acpi-build.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4cc1440..9973ac6 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1498,13 +1498,16 @@ build_srat(GArray *table_data, GArray *linker, PcGuestInfo *guest_info) next_base = 0; numa_start = table_data->len; - numamem = acpi_data_push(table_data, sizeof *numamem); - acpi_build_srat_memory(numamem, 0, 640*1024, 0, MEM_AFFINITY_ENABLED); - next_base = 1024 * 1024; for (i = 1; i < guest_info->numa_nodes + 1; ++i) { mem_base = next_base; mem_len = guest_info->node_mem[i - 1]; - if (i == 1) { + if (mem_len == 0) { + continue; + } + if (mem_base == 0) { + numamem = acpi_data_push(table_data, sizeof *numamem); + acpi_build_srat_memory(numamem, 0, 640*1024, i - 1, MEM_AFFINITY_ENABLED); + mem_base = 1024 * 1024; mem_len -= 1024 * 1024; } next_base = mem_base + mem_len; -- 2.5.0