From a0cc8856e8722188583901665c7d9e5ddc752fc0 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:09 +0200 Subject: [PATCH] pc: exit QEMU if number of slots more than supported 256 ... 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 --- hw/i386/pc.c | 6 ++++++ include/hw/acpi/acpi.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6cdcb0048d..366e799bb0 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1230,6 +1230,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); diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index a9fae9d5c5..e93de6cab1 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 */ -- 2.11.4.GIT