[qemu] Fix loading arm initrd if kernel is very large (bz #862766) Don't use reserved word 'function' in sy
Cole Robinson
crobinso at fedoraproject.org
Wed Oct 31 00:57:21 UTC 2012
commit 771708e98869abfa29ef083b034a0ac9c512736b
Author: Cole Robinson <crobinso at redhat.com>
Date: Tue Oct 30 20:56:59 2012 -0400
Fix loading arm initrd if kernel is very large (bz #862766)
Don't use reserved word 'function' in systemtap files (bz #871286)
Drop assertion that was triggering when pausing guests w/ qxl (bz #870972)
...ange-initrd-load-address-to-halfway-throu.patch | 138 ++++++++++++++++++++
...ce-backend-add-function-to-reserved-words.patch | 27 ++++
...wip-hw-qxl-inject-interrupts-in-any-state.patch | 24 ++++
qemu.spec | 18 +++-
4 files changed, 206 insertions(+), 1 deletions(-)
---
diff --git a/0802-arm_boot-Change-initrd-load-address-to-halfway-throu.patch b/0802-arm_boot-Change-initrd-load-address-to-halfway-throu.patch
new file mode 100644
index 0000000..649fb0e
--- /dev/null
+++ b/0802-arm_boot-Change-initrd-load-address-to-halfway-throu.patch
@@ -0,0 +1,138 @@
+From d3a43fe4b870154032db4651824bc88e3cb81dc5 Mon Sep 17 00:00:00 2001
+From: Peter Maydell <peter.maydell at linaro.org>
+Date: Fri, 26 Oct 2012 16:29:38 +0100
+Subject: [PATCH] arm_boot: Change initrd load address to "halfway through
+ RAM"
+
+To avoid continually having to bump the initrd load address
+to account for larger kernel images, put the initrd halfway
+through RAM. This allows large kernels on new boards with lots
+of RAM to work OK, without breaking existing usecases for
+boards with only 32MB of RAM.
+
+Note that this change fixes in passing a bug where we were
+passing an overly large max_size to load_image_targphys()
+for the initrd, which meant that we wouldn't correctly refuse
+to load an enormous initrd that didn't actually fit into RAM.
+
+Signed-off-by: Peter Maydell <peter.maydell at linaro.org>
+---
+ hw/arm-misc.h | 1 +
+ hw/arm_boot.c | 41 ++++++++++++++++++++++++++---------------
+ 2 files changed, 27 insertions(+), 15 deletions(-)
+
+diff --git a/hw/arm-misc.h b/hw/arm-misc.h
+index bdd8fec..0f7deb5 100644
+--- a/hw/arm-misc.h
++++ b/hw/arm-misc.h
+@@ -56,6 +56,7 @@ struct arm_boot_info {
+ const struct arm_boot_info *info);
+ /* Used internally by arm_boot.c */
+ int is_linux;
++ target_phys_addr_t initrd_start;
+ target_phys_addr_t initrd_size;
+ target_phys_addr_t entry;
+ };
+diff --git a/hw/arm_boot.c b/hw/arm_boot.c
+index a6e9143..920c337 100644
+--- a/hw/arm_boot.c
++++ b/hw/arm_boot.c
+@@ -18,7 +18,6 @@
+
+ #define KERNEL_ARGS_ADDR 0x100
+ #define KERNEL_LOAD_ADDR 0x00010000
+-#define INITRD_LOAD_ADDR 0x00d00000
+
+ /* The worlds second smallest bootloader. Set r0-r2, then jump to kernel. */
+ static uint32_t bootloader[] = {
+@@ -109,7 +108,7 @@ static void set_kernel_args(const struct arm_boot_info *info)
+ /* ATAG_INITRD2 */
+ WRITE_WORD(p, 4);
+ WRITE_WORD(p, 0x54420005);
+- WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR);
++ WRITE_WORD(p, info->initrd_start);
+ WRITE_WORD(p, initrd_size);
+ }
+ if (info->kernel_cmdline && *info->kernel_cmdline) {
+@@ -185,10 +184,11 @@ static void set_kernel_args_old(const struct arm_boot_info *info)
+ /* pages_in_vram */
+ WRITE_WORD(p, 0);
+ /* initrd_start */
+- if (initrd_size)
+- WRITE_WORD(p, info->loader_start + INITRD_LOAD_ADDR);
+- else
++ if (initrd_size) {
++ WRITE_WORD(p, info->initrd_start);
++ } else {
+ WRITE_WORD(p, 0);
++ }
+ /* initrd_size */
+ WRITE_WORD(p, initrd_size);
+ /* rd_start */
+@@ -281,14 +281,13 @@ static int load_dtb(target_phys_addr_t addr, const struct arm_boot_info *binfo)
+
+ if (binfo->initrd_size) {
+ rc = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-start",
+- binfo->loader_start + INITRD_LOAD_ADDR);
++ binfo->initrd_start);
+ if (rc < 0) {
+ fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n");
+ }
+
+ rc = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-end",
+- binfo->loader_start + INITRD_LOAD_ADDR +
+- binfo->initrd_size);
++ binfo->initrd_start + binfo->initrd_size);
+ if (rc < 0) {
+ fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n");
+ }
+@@ -375,6 +374,19 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
+ big_endian = 0;
+ #endif
+
++ /* We want to put the initrd far enough into RAM that when the
++ * kernel is uncompressed it will not clobber the initrd. However
++ * on boards without much RAM we must ensure that we still leave
++ * enough room for a decent sized initrd, and on boards with large
++ * amounts of RAM we must avoid the initrd being so far up in RAM
++ * that it is outside lowmem and inaccessible to the kernel.
++ * So for boards with less than 256MB of RAM we put the initrd
++ * halfway into RAM, and for boards with 256MB of RAM or more we put
++ * the initrd at 128MB.
++ */
++ info->initrd_start = info->loader_start +
++ MIN(info->ram_size / 2, 128 * 1024 * 1024);
++
+ /* Assume that raw images are linux kernels, and ELF images are not. */
+ kernel_size = load_elf(info->kernel_filename, NULL, NULL, &elf_entry,
+ NULL, NULL, big_endian, ELF_MACHINE, 1);
+@@ -398,10 +410,9 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
+ if (is_linux) {
+ if (info->initrd_filename) {
+ initrd_size = load_image_targphys(info->initrd_filename,
+- info->loader_start
+- + INITRD_LOAD_ADDR,
+- info->ram_size
+- - INITRD_LOAD_ADDR);
++ info->initrd_start,
++ info->ram_size -
++ info->initrd_start);
+ if (initrd_size < 0) {
+ fprintf(stderr, "qemu: could not load initrd '%s'\n",
+ info->initrd_filename);
+@@ -419,9 +430,9 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
+ */
+ if (info->dtb_filename) {
+ /* Place the DTB after the initrd in memory */
+- target_phys_addr_t dtb_start = TARGET_PAGE_ALIGN(info->loader_start
+- + INITRD_LOAD_ADDR
+- + initrd_size);
++ target_phys_addr_t dtb_start = TARGET_PAGE_ALIGN(
++ info->initrd_start +
++ initrd_size);
+ if (load_dtb(dtb_start, info)) {
+ exit(1);
+ }
+--
+1.7.12.1
+
diff --git a/0803-dtrace-backend-add-function-to-reserved-words.patch b/0803-dtrace-backend-add-function-to-reserved-words.patch
new file mode 100644
index 0000000..cc58c6f
--- /dev/null
+++ b/0803-dtrace-backend-add-function-to-reserved-words.patch
@@ -0,0 +1,27 @@
+From 4780bb16558d2753e2277e1570644bec49551534 Mon Sep 17 00:00:00 2001
+From: Alon Levy <alevy at redhat.com>
+Date: Sun, 2 Sep 2012 02:04:16 +0300
+Subject: [PATCH] dtrace backend: add function to reserved words
+
+Signed-off-by: Alon Levy <alevy at redhat.com>
+Signed-off-by: Stefan Hajnoczi <stefanha at gmail.com>
+---
+ scripts/tracetool/backend/dtrace.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
+index 9cab75c..6be7047 100644
+--- a/scripts/tracetool/backend/dtrace.py
++++ b/scripts/tracetool/backend/dtrace.py
+@@ -87,7 +87,7 @@ def stap(events):
+ if len(e.args) > 0:
+ for name in e.args.names():
+ # Append underscore to reserved keywords
+- if name in ('limit', 'in', 'next', 'self'):
++ if name in ('limit', 'in', 'next', 'self', 'function'):
+ name += '_'
+ out(' %s = $arg%d;' % (name, i))
+ i += 1
+--
+1.7.12.1
+
diff --git a/0804-wip-hw-qxl-inject-interrupts-in-any-state.patch b/0804-wip-hw-qxl-inject-interrupts-in-any-state.patch
new file mode 100644
index 0000000..4e5222d
--- /dev/null
+++ b/0804-wip-hw-qxl-inject-interrupts-in-any-state.patch
@@ -0,0 +1,24 @@
+From e0575d0a1a14e8f4e8fc11d549cbd07cca433383 Mon Sep 17 00:00:00 2001
+From: Alon Levy <alevy at redhat.com>
+Date: Tue, 30 Oct 2012 18:00:33 +0200
+Subject: [PATCH] wip: hw/qxl: inject interrupts in any state
+
+---
+ hw/qxl.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/hw/qxl.c b/hw/qxl.c
+index 9389752..b137731 100644
+--- a/hw/qxl.c
++++ b/hw/qxl.c
+@@ -1714,7 +1714,6 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
+ uint32_t le_events = cpu_to_le32(events);
+
+ trace_qxl_send_events(d->id, events);
+- assert(qemu_spice_display_is_running(&d->ssd));
+ old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events);
+ if ((old_pending & le_events) == le_events) {
+ return;
+--
+1.7.12.1
+
diff --git a/qemu.spec b/qemu.spec
index a596ecf..ae8ae6b 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -109,7 +109,7 @@
Summary: QEMU is a FAST! processor emulator
Name: qemu
Version: 1.2.0
-Release: 17%{?dist}
+Release: 18%{?dist}
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
Epoch: 2
License: GPLv2+ and LGPLv2+ and BSD
@@ -466,6 +466,13 @@ Patch0800: 0800-mips-Fix-link-error-with-piix4_pm_init.patch
# Add ./configure --disable-kvm-options
# keep: Carrying locally until qemu-kvm is fully merged into qemu.git
Patch0801: 0801-configure-Add-disable-kvm-options.patch
+# Fix loading arm initrd if kernel is very large (bz 862766)
+Patch802: 0802-arm_boot-Change-initrd-load-address-to-halfway-throu.patch
+# Don't use reserved word 'function' in systemtap files (bz 870972)
+Patch803: 0803-dtrace-backend-add-function-to-reserved-words.patch
+# Drop assertion that was triggering when pausing guests w/ qxl (bz
+# 870972)
+Patch804: 0804-wip-hw-qxl-inject-interrupts-in-any-state.patch
BuildRequires: SDL-devel
@@ -1198,6 +1205,9 @@ such as kvm_stat.
%patch0800 -p1
%patch0801 -p1
+%patch802 -p1
+%patch803 -p1
+%patch804 -p1
%build
@@ -1790,6 +1800,12 @@ fi
%{_mandir}/man1/qemu-img.1*
%changelog
+* Tue Oct 30 2012 Cole Robinson <crobinso at redhat.com> - 2:1.2.0-18
+- Fix loading arm initrd if kernel is very large (bz #862766)
+- Don't use reserved word 'function' in systemtap files (bz #870972)
+- Drop assertion that was triggering when pausing guests w/ qxl (bz
+ #870972)
+
* Sun Oct 28 2012 Cole Robinson <crobinso at redhat.com> - 2:1.2.0-17
- Pull patches queued for qemu 1.2.1
More information about the scm-commits
mailing list