From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC4xY-0008Kb-7h for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:48:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC4xQ-0001LD-PJ for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:48:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC4xQ-0001L7-HD for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:48:36 -0400 Date: Tue, 29 Jul 2014 12:48:48 +0200 From: "Michael S. Tsirkin" Message-ID: <1406630860-13530-7-git-send-email-mst@redhat.com> References: <1406630860-13530-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1406630860-13530-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 6/8] pc: future-proof migration-compatibility of ACPI tables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Laszlo Ersek , Anthony Liguori , Paolo Bonzini From: Paolo Bonzini This patch avoids that similar changes break QEMU again in the future. QEMU will now hard-code 64k as the maximum ACPI table size, which (despite being an order of magnitude smaller than 640k) should be enough for everyone. Reviewed-by: Laszlo Ersek Tested-by: Igor Mammedov Signed-off-by: Paolo Bonzini Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index ec86f1b..2178894 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -62,6 +62,8 @@ #define ACPI_BUILD_LEGACY_CPU_AML_SIZE 97 #define ACPI_BUILD_ALIGN_SIZE 0x1000 +#define ACPI_BUILD_TABLE_SIZE 0x10000 + typedef struct AcpiCpuInfo { DECLARE_BITMAP(found_cpus, ACPI_CPU_HOTPLUG_ID_LIMIT); } AcpiCpuInfo; @@ -1588,7 +1590,13 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) } g_array_set_size(tables->table_data, legacy_table_size); } else { - acpi_align_size(tables->table_data, ACPI_BUILD_ALIGN_SIZE); + if (tables->table_data->len > ACPI_BUILD_TABLE_SIZE) { + /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ + error_report("ACPI tables are larger than 64k. Please remove"); + error_report("CPUs, NUMA nodes, memory slots or PCI bridges."); + exit(1); + } + g_array_set_size(tables->table_data, ACPI_BUILD_TABLE_SIZE); } acpi_align_size(tables->linker, ACPI_BUILD_ALIGN_SIZE); -- MST