From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBlVd-0001PG-LF for qemu-devel@nongnu.org; Mon, 28 Jul 2014 10:02:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBlVW-0004c6-6K for qemu-devel@nongnu.org; Mon, 28 Jul 2014 10:02:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBlVV-0004bz-UA for qemu-devel@nongnu.org; Mon, 28 Jul 2014 10:02:30 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6SE2STD012042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 28 Jul 2014 10:02:29 -0400 From: Paolo Bonzini Date: Mon, 28 Jul 2014 16:02:13 +0200 Message-Id: <1406556135-31717-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1406556135-31717-1-git-send-email-pbonzini@redhat.com> References: <1406556135-31717-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 3/5] 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: imammedo@redhat.com, lersek@redhat.com, mst@redhat.com 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 --- 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 7d2251f..8d42eaf 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -63,6 +63,8 @@ #define ACPI_BUILD_LEGACY_BRIDGE_AML_SIZE 1875 #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; @@ -1593,7 +1595,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); -- 1.8.3.1