Commit e6ade764ebbbac9a0ce2f710ef0d97272eb1657f

Authored by Glauber Costa
Committed by Anthony Liguori
1 parent 95b134ea

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.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Showing 1 changed file with 5 additions and 4 deletions
@@ -596,7 +596,8 @@ static long get_file_size(FILE *f) @@ -596,7 +596,8 @@ static long get_file_size(FILE *f)
596 static void load_linux(target_phys_addr_t option_rom, 596 static void load_linux(target_phys_addr_t option_rom,
597 const char *kernel_filename, 597 const char *kernel_filename,
598 const char *initrd_filename, 598 const char *initrd_filename,
599 - const char *kernel_cmdline) 599 + const char *kernel_cmdline,
  600 + target_phys_addr_t max_ram_size)
600 { 601 {
601 uint16_t protocol; 602 uint16_t protocol;
602 uint32_t gpr[8]; 603 uint32_t gpr[8];
@@ -662,8 +663,8 @@ static void load_linux(target_phys_addr_t option_rom, @@ -662,8 +663,8 @@ static void load_linux(target_phys_addr_t option_rom,
662 else 663 else
663 initrd_max = 0x37ffffff; 664 initrd_max = 0x37ffffff;
664 665
665 - if (initrd_max >= ram_size-ACPI_DATA_SIZE)  
666 - initrd_max = ram_size-ACPI_DATA_SIZE-1; 666 + if (initrd_max >= max_ram_size-ACPI_DATA_SIZE)
  667 + initrd_max = max_ram_size-ACPI_DATA_SIZE-1;
667 668
668 /* kernel command line */ 669 /* kernel command line */
669 pstrcpy_targphys(cmdline_addr, 4096, kernel_cmdline); 670 pstrcpy_targphys(cmdline_addr, 4096, kernel_cmdline);
@@ -960,7 +961,7 @@ static void pc_init1(ram_addr_t ram_size, @@ -960,7 +961,7 @@ static void pc_init1(ram_addr_t ram_size,
960 961
961 if (linux_boot) { 962 if (linux_boot) {
962 load_linux(0xc0000 + oprom_area_size, 963 load_linux(0xc0000 + oprom_area_size,
963 - kernel_filename, initrd_filename, kernel_cmdline); 964 + kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
964 oprom_area_size += 2048; 965 oprom_area_size += 2048;
965 } 966 }
966 967