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: 8976861 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87310BF29F for ; Fri, 29 Apr 2016 03:41:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E140E20219 for ; Fri, 29 Apr 2016 03:40:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 194D12020F for ; Fri, 29 Apr 2016 03:40:59 +0000 (UTC) Received: from localhost ([::1]:52116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzIY-0005QY-8y for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Apr 2016 23:40:58 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);