Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > aadbe78a25743146bb784eee19f007c5 > files > 312

kvm-83-164.el5_5.9.src.rpm

From 2dea4abec3e90f9c7d2e1dc8ad8972e30702dc1f Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Wed, 28 Oct 2009 10:08:06 -0200
Subject: [PATCH] keep initrd in below 4g area

RH-Author: Eduardo Habkost <ehabkost@redhat.com>
Message-id: <1256668732-4348-1-git-send-email-ehabkost@redhat.com>
Patchwork-id: 3635
O-Subject: [RHEL-5.5 KVM PATCH] keep initrd in below 4g area
Bugzilla: 529694
RH-Acked-by: Avi Kivity <avi@redhat.com>
RH-Acked-by: Glauber Costa <glommer@redhat.com>
RH-Acked-by: Mark McLoughlin <markmc@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>

Backport of upstream commit, submitted by IBM on Bugzilla.

https://bugzilla.redhat.com/show_bug.cgi?id=529694

Author: Glauber Costa <glommer@redhat.com>
Date:   Mon May 18 16:35:58 2009 -0400

    keep initrd in below 4g area.

    initrd must be kept on the memory area below 4g. By not doing this,
    we're seeing guests break while using -initrd and values of -mem
    superior to 4096.

    aliguori: ported to kvm-83-105.el5

    Signed-off-by: Glauber Costa <glommer@redhat.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 qemu/hw/pc.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/hw/pc.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index b61d5eb..5bbde07 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -554,7 +554,8 @@ static long get_file_size(FILE *f)
 static void load_linux(uint8_t *option_rom,
                        const char *kernel_filename,
 		       const char *initrd_filename,
-		       const char *kernel_cmdline)
+		       const char *kernel_cmdline,
+		       target_phys_addr_t max_ram_size)
 {
     uint16_t protocol;
     uint32_t gpr[8];
@@ -620,8 +621,8 @@ static void load_linux(uint8_t *option_rom,
     else
 	initrd_max = 0x37ffffff;
 
-    if (initrd_max >= ram_size-ACPI_DATA_SIZE)
-	initrd_max = ram_size-ACPI_DATA_SIZE-1;
+    if (initrd_max >= max_ram_size-ACPI_DATA_SIZE)
+    	initrd_max = max_ram_size-ACPI_DATA_SIZE-1;
 
     /* kernel command line */
     pstrcpy_targphys(cmdline_addr, 4096, kernel_cmdline);
@@ -959,7 +960,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
         if (linux_boot) {
             option_rom_offset = qemu_ram_alloc(TARGET_PAGE_SIZE);
             load_linux(phys_ram_base + option_rom_offset,
-                       kernel_filename, initrd_filename, kernel_cmdline);
+                       kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
             cpu_register_physical_memory(0xd0000, TARGET_PAGE_SIZE,
                                          option_rom_offset | IO_MEM_ROM);
             offset = TARGET_PAGE_SIZE;
-- 
1.6.3.rc4.29.g8146