SHA256
1
0
forked from pool/qemu
qemu/0040-fix-xen-hvm-direct-kernel-boot.patch
Bruce Rogers fb435f43f3 Accepting request 493037 from home:bfrogers:branches:Virtualization
Fix build issues for some older distros. Also includes fixing broken parts of spec file when not building x86 firmware.

OBS-URL: https://build.opensuse.org/request/show/493037
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=338
2017-05-05 15:05:43 +00:00

55 lines
2.0 KiB
Diff

From 301054b84a2e3b31768ec107f549e4742c4a15d6 Mon Sep 17 00:00:00 2001
From: Chunyan Liu <cyliu@suse.com>
Date: Fri, 29 Apr 2016 11:17:08 +0800
Subject: [PATCH] fix xen hvm direct kernel boot
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.
[CYL: BSC#970791]
Signed-off-by: Chunyan Liu <cyliu@suse.com>
---
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 bf17b42cbe..14dc6e116f 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 <zlib.h>
@@ -866,7 +867,10 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name, bool ro)
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);