Skip to contentSkip to conversation

acpi: allow NUMA memoryless node 0

PATCH New Thadeu Lima de Souza Cascardo 1 participant 1 message Dec 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi: allow NUMA memoryless node 0

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.

---
 hw/i386/acpi-build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
hw/i386/acpi-build.c +7 -4
index 4cc1440..9973ac6 100644
@@ -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;
Signature · 1 line
2.5.0