From patchwork Fri Apr 29 03:43:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 616579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qwzxw5JrKz9t7T for ; Fri, 29 Apr 2016 13:41:08 +1000 (AEST) Received: from localhost ([::1]:52117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzIh-0005rH-1d for incoming@patchwork.ozlabs.org; Thu, 28 Apr 2016 23:41:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzIQ-0005Mp-Ol for qemu-devel@nongnu.org; Thu, 28 Apr 2016 23:40:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avzIN-0007gq-Hj for qemu-devel@nongnu.org; Thu, 28 Apr 2016 23:40:50 -0400 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:38927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzIN-0007gk-AG for qemu-devel@nongnu.org; Thu, 28 Apr 2016 23:40:47 -0400 Received: from linux-gak8.lab.bej.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (TLS encrypted); Thu, 28 Apr 2016 21:40:41 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Fri, 29 Apr 2016 11:43:56 +0800 Message-Id: <1461901436-6881-1-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.8.5.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.26 Subject: [Qemu-devel] [PATCH] fix xen hvm direct kernel boot X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: george.dunlap@eu.citrix.com, Chunyan Liu , stefano.stabellini@eu.citrix.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since commit a1666142: acpi-build: make ROMs RAM blocks resizeable, xen HVM direct kernel boot failed. Xen HVM direct kernel boot will insert a linuxboot.bin or multiboot.bin to /genroms, before this commit, in acpi_setup, for rom linuxboot.bin/multiboot.bin, it only needs 0x20000 size; after the commit, it will reserve x16 size for resize, that is 0x200000 size. It causes xen_ram_alloc failed due to running out of memory. To resolve it, either: 1. keep using original rom size instead of max size, don't reserve x16 size. 2. guest maxmem needs to be increased. (commit c1d322e6 "xen-hvm: increase maxmem before calling xc_domain_populate_physmap" solved the problem for a time, by accident. But then it is reverted in commit ffffbb369 due to other problem.) For 2, more discussion is needed about howto. So this patch tries 1, to use unresizable rom size in xen case in rom_set_mr. Signed-off-by: Chunyan Liu --- hw/core/loader.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index c049957..5150101 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -55,6 +55,7 @@ #include "exec/address-spaces.h" #include "hw/boards.h" #include "qemu/cutils.h" +#include "hw/xen/xen.h" #include @@ -818,7 +819,10 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name) void *data; rom->mr = g_malloc(sizeof(*rom->mr)); - memory_region_init_resizeable_ram(rom->mr, owner, name, + if (xen_enabled()) + memory_region_init_ram(rom->mr, owner, name, rom->datasize, &error_fatal); + else + memory_region_init_resizeable_ram(rom->mr, owner, name, rom->datasize, rom->romsize, fw_cfg_resized, &error_fatal);