From patchwork Wed Dec 24 16:07:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 423949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0B2C4140081 for ; Thu, 25 Dec 2014 03:12:34 +1100 (AEDT) Received: from localhost ([::1]:48778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3oY4-0006Yw-6W for incoming@patchwork.ozlabs.org; Wed, 24 Dec 2014 11:12:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3oTl-0007MV-Ph for qemu-devel@nongnu.org; Wed, 24 Dec 2014 11:08:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y3oTj-00075z-NJ for qemu-devel@nongnu.org; Wed, 24 Dec 2014 11:08:05 -0500 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:36621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3oTj-00075o-E7 for qemu-devel@nongnu.org; Wed, 24 Dec 2014 11:08:03 -0500 Received: by mail-wi0-f181.google.com with SMTP id r20so13914221wiv.14 for ; Wed, 24 Dec 2014 08:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=TFqN0aJbFQX3EWtZmC1FE8ZVpxKWYaMlYXzt6thy1VU=; b=DKa96Mmqs6937bHxzmWzO55JX6FuVemCZ9/sR30ryFYVS1cT2Ht8Y72zh2T+vLMn7L LtYNzMgSE94Yqk0Bv1QnfP548A0Sgb0tmUjyqKoYWS39Wl4qzZ16VvqaB4LSW8oCbhzD Wl6BVe6nlkUd0tES4JQ47CBjpke8o+UgGiZ6k131cK2JEdbGnt3MlA/w4xDFdPYKDWWa VVCwmdFlB4DbHPJq0Xqu/8RhO4yRLTtU1ovxXWf7rkWpW1UEOgUce0yz+fXwuPZaRU/e ZkMmTV64e/Id9mD8IkYTzA1rSeWEi97USP4RFaPP+YUe4fut47sL/5O57Ixwg7I+Qfmk zJwQ== X-Received: by 10.181.13.106 with SMTP id ex10mr52424176wid.36.1419437282568; Wed, 24 Dec 2014 08:08:02 -0800 (PST) Received: from playground.station (net-37-117-147-67.cust.vodafonedsl.it. [37.117.147.67]) by mx.google.com with ESMTPSA id s4sm21651617wiy.13.2014.12.24.08.08.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Dec 2014 08:08:01 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 24 Dec 2014 17:07:39 +0100 Message-Id: <1419437261-21113-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1419437261-21113-1-git-send-email-pbonzini@redhat.com> References: <1419437261-21113-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::235 Cc: imammedo@redhat.com, dgilbert@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 5/4] pc: introduce new ACPI table sizing algorithm X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add padding after the DSDT. Tables that vary depending on the command-line arguments will have to be byte-equivalent across QEMU versions >= 2.2, while fixed tables (including the DSDT) can be changed freely. Signed-off-by: Paolo Bonzini --- hw/i386/acpi-build.c | 19 +++++++++++-------- hw/i386/pc_piix.c | 5 +++++ include/hw/i386/pc.h | 2 ++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 63f3d80..1bb3222 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -67,8 +67,6 @@ #define ACPI_BUILD_LEGACY_CPU_AML_SIZE 97 #define ACPI_BUILD_ALIGN_SIZE 0x1000 -#define ACPI_BUILD_TABLE_SIZE 0x20000 - /* #define DEBUG_ACPI_BUILD */ #ifdef DEBUG_ACPI_BUILD #define ACPI_BUILD_DPRINTF(fmt, ...) \ @@ -1614,6 +1612,10 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables->table_data); build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt); + if (guest_info->fixed_table_align) { + acpi_align_size(tables->table_data, guest_info->fixed_table_align); + } + ssdt = tables->table_data->len; acpi_add_table(table_offsets, tables->table_data); build_ssdt(tables->table_data, tables->linker, &cpu, &pm, guest_info); @@ -1696,15 +1698,16 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) } g_array_set_size(tables->table_data, legacy_table_size); } else { - /* Make sure we have a buffer in case we need to resize the tables. */ - if (tables->table_data->len > ACPI_BUILD_TABLE_SIZE / 2) { - /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ + /* Suggest upgrading to the newer algorithm if close to the limit. + * As of QEMU 2.1, this fired with 160 VCPUs and 255 memory slots. + */ + if (!guest_info->fixed_table_align && + tables->table_data->len > guest_info->acpi_table_align / 2) { error_report("Warning: ACPI tables are larger than 64k."); error_report("Warning: migration may not work."); - error_report("Warning: please remove CPUs, NUMA nodes, " - "memory slots or PCI bridges."); + error_report("Warning: please upgrade to a newer machine type."); } - acpi_align_size(tables->table_data, ACPI_BUILD_TABLE_SIZE); + acpi_align_size(tables->table_data, guest_info->acpi_table_align); } acpi_align_size(tables->linker, ACPI_BUILD_ALIGN_SIZE); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 220f741..16de5c9 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -61,6 +61,8 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; static bool has_acpi_build = true; static int legacy_acpi_table_size; +static int fixed_table_align = 0; +static int acpi_table_align = 131072; static bool smbios_defaults = true; static bool smbios_legacy_mode; static bool smbios_uuid_encoded = true; @@ -165,6 +167,8 @@ static void pc_init1(MachineState *machine, guest_info->has_acpi_build = has_acpi_build; guest_info->legacy_acpi_table_size = legacy_acpi_table_size; + guest_info->fixed_table_align = fixed_table_align; + guest_info->acpi_table_align = acpi_table_align; guest_info->isapc_ram_fw = !pci_enabled; guest_info->has_reserved_memory = has_reserved_memory; @@ -362,6 +366,7 @@ static void pc_compat_2_0(MachineState *machine) * QEMU 1.7 it is 6414. For RHEL/CentOS 7.0 it is 6418. */ legacy_acpi_table_size = 6652; + acpi_table_align = 4096; smbios_legacy_mode = true; has_reserved_memory = false; pc_set_legacy_acpi_data_size(); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e475b92..70fb47c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -102,6 +102,8 @@ struct PcGuestInfo { uint64_t *node_cpu; FWCfgState *fw_cfg; int legacy_acpi_table_size; + int fixed_table_align; + int acpi_table_align; bool has_acpi_build; bool has_reserved_memory; };