From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxJb-0003L3-Aa for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwxJV-000330-6I for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxJU-00032o-TW for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:53 -0400 Date: Tue, 17 Jun 2014 20:37:04 +0300 From: "Michael S. Tsirkin" Message-ID: <1403021756-15960-14-git-send-email-mst@redhat.com> References: <1403021756-15960-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403021756-15960-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 013/103] pc: exit QEMU if number of slots more than supported 256 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex Bligh , Stefan Hajnoczi , Peter Crosthwaite , Igor Mammedov , Anthony Liguori From: Igor Mammedov ... which is imposed by current naming scheme of ACPI memory devices. Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/acpi.h | 6 ++++++ hw/i386/pc.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index a9fae9d..e93de6c 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -26,6 +26,12 @@ #include "exec/memory.h" #include "hw/irq.h" +/* + * current device naming scheme supports + * only upto 256 memory devices + */ +#define ACPI_MAX_RAM_SLOTS 256 + /* from linux include/acpi/actype.h */ /* Default ACPI register widths */ diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 740eac3..c59fad3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1234,6 +1234,12 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory, ram_addr_t hotplug_mem_size = machine->maxram_size - ram_size; + if (machine->ram_slots > ACPI_MAX_RAM_SLOTS) { + error_report("unsupported amount of memory slots: %"PRIu64, + machine->ram_slots); + exit(EXIT_FAILURE); + } + pcms->hotplug_memory_base = ROUND_UP(0x100000000ULL + above_4g_mem_size, 1ULL << 30); -- MST