From patchwork Sun Aug 24 22:18:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 382585 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 81A731400AA for ; Mon, 25 Aug 2014 08:22:28 +1000 (EST) Received: from localhost ([::1]:45461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLgB8-0000Kh-9E for incoming@patchwork.ozlabs.org; Sun, 24 Aug 2014 18:22:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLg71-0001QJ-DQ for qemu-devel@nongnu.org; Sun, 24 Aug 2014 18:18:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLg6w-0000Lf-6U for qemu-devel@nongnu.org; Sun, 24 Aug 2014 18:18:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLg6v-0000LV-Ua; Sun, 24 Aug 2014 18:18:06 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7OMHrJ5023967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 24 Aug 2014 18:17:54 -0400 Received: from redhat.com (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s7OMHo1B002212; Sun, 24 Aug 2014 18:17:51 -0400 Date: Mon, 25 Aug 2014 00:18:25 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1408918641-14167-5-git-send-email-mst@redhat.com> References: <1408918641-14167-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1408918641-14167-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Stefan Hajnoczi , qemu-stable@nongnu.org, Anthony Liguori Subject: [Qemu-devel] [PULL 04/11] pc: reserve more memory for ACPI for new machine types 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 commit 868270f23d8db2cce83e4f082fe75e8625a5fbf9 acpi-build: tweak acpi migration limits broke kernel loading with -kernel/-initrd: it doubled the size of ACPI tables but did not reserve enough memory. As a result, issues on boot and halt are observed. Fix this up by doubling reserved memory for new machine types. Cc: qemu-stable@nongnu.org Reported-by: Stefan Hajnoczi Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 2 ++ hw/i386/pc.c | 12 +++++++++--- hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 0fca9e3..a39cb42 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -176,6 +176,8 @@ void pc_acpi_init(const char *default_dsdt); PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size); +void pc_set_legacy_acpi_data_size(void); + #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 8fa8d2f..0ca4deb 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -73,7 +73,12 @@ #endif /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables. */ -#define ACPI_DATA_SIZE 0x10000 +unsigned acpi_data_size = 0x20000; +void pc_set_legacy_acpi_data_size(void) +{ + acpi_data_size = 0x10000; +} + #define BIOS_CFG_IOPORT 0x510 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) @@ -811,8 +816,9 @@ static void load_linux(FWCfgState *fw_cfg, initrd_max = 0x37ffffff; } - if (initrd_max >= max_ram_size-ACPI_DATA_SIZE) - initrd_max = max_ram_size-ACPI_DATA_SIZE-1; + if (initrd_max >= max_ram_size - acpi_data_size) { + initrd_max = max_ram_size - acpi_data_size - 1; + } fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_ADDR, cmdline_addr); fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(kernel_cmdline)+1); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 47ac1b5..103d756 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -323,6 +323,7 @@ static void pc_compat_2_0(MachineState *machine) legacy_acpi_table_size = 6652; smbios_legacy_mode = true; has_reserved_memory = false; + pc_set_legacy_acpi_data_size(); } static void pc_compat_1_7(MachineState *machine) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 4b5a274..d4a907c 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -280,6 +280,7 @@ static void pc_compat_2_0(MachineState *machine) { smbios_legacy_mode = true; has_reserved_memory = false; + pc_set_legacy_acpi_data_size(); } static void pc_compat_1_7(MachineState *machine)