Received: from eggs.gnu.org ([2001:4830:134:3::10]:35119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDxQ9-0007rv-0g for qemu-devel@nongnu.org; Tue, 29 Dec 2015 11:46:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDxQ8-0006by-7G for qemu-devel@nongnu.org; Tue, 29 Dec 2015 11:46:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDxQ8-0006bu-0w for qemu-devel@nongnu.org; Tue, 29 Dec 2015 11:46:48 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 439D580081 for ; Tue, 29 Dec 2015 16:46:47 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBTGkjo9013825 for ; Tue, 29 Dec 2015 11:46:46 -0500 From: Thadeu Lima de Souza Cascardo Date: Tue, 29 Dec 2015 14:46:39 -0200 Message-Id: <1451407599-29311-1-git-send-email-cascardo@redhat.com> Subject: [Qemu-devel] [PATCH] acpi: allow NUMA memoryless node 0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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