From patchwork Fri Apr 29 03:43:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 8976921 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 C2CE4BF29F for ; Fri, 29 Apr 2016 04:18:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2750C20219 for ; Fri, 29 Apr 2016 04:18:30 +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 3B46F2015A for ; Fri, 29 Apr 2016 04:18:29 +0000 (UTC) Received: from localhost ([::1]:52182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzsq-0007wn-Ih for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Apr 2016 00:18:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzsi-0007sg-QP for qemu-devel@nongnu.org; Fri, 29 Apr 2016 00:18:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avzsd-0007tC-Sx for qemu-devel@nongnu.org; Fri, 29 Apr 2016 00:18:20 -0400 Received: from [203.192.156.9] (port=37554 helo=linux-gak8.suse) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avzsd-0007rs-Fq for qemu-devel@nongnu.org; Fri, 29 Apr 2016 00:18:15 -0400 Received: by linux-gak8.suse (Postfix, from userid 0) id 87241197; Fri, 29 Apr 2016 11:43:23 +0800 (CST) From: Chunyan Liu To: qemu-devel@nongnu.org Date: Fri, 29 Apr 2016 11:43:21 +0800 Message-Id: <1461901401-6811-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 2.2.x-3.x [generic] X-Received-From: 203.192.156.9 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=ham 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);