summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Jarno2017-08-01 00:52:10 +0200
committerYongbok Kim2017-08-02 18:01:27 +0200
commit9652ef24bfaf59ba179787503fdf7eae6e95475b (patch)
tree7c0a64975b900ad68c6b8a29066b5b138715fc37
parenttarget-mips: Don't stop on [d]mtc0 DESAVE/KScratch (diff)
downloadqemu-9652ef24bfaf59ba179787503fdf7eae6e95475b.tar.gz
qemu-9652ef24bfaf59ba179787503fdf7eae6e95475b.tar.xz
qemu-9652ef24bfaf59ba179787503fdf7eae6e95475b.zip
mips/malta: leave space for the bootmap after the initrd
Since commit 9768e2abf7 the initrd is loaded at the end of the low memory to avoid clash for the kernel relocation when kaslr is used. However this in turn conflicts with the bootmap memory that the kernel tries to place after initrd, but in low memory. The bootmap spans the whole usable physical address space. The machine can have at most 2GiB of memory, 256MiB of low memory mapped at 0x00000000, and 1792MiB of high memory mapped at 0x90000000. The biggest bootmap therefore corresponds to the adresses 0x00000000 -> 0xffffffff, which at 1 bit per 4kiB page corresponds to 128kiB in memory. Therefore reserve 128kiB after the initrd. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Tested-by: Yongbok Kim <yongbok.kim@imgtec.com> Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
-rw-r--r--hw/mips/mips_malta.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 8ecd544baa..9dcec27304 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -843,7 +843,10 @@ static int64_t load_kernel (void)
if (loaderparams.initrd_filename) {
initrd_size = get_image_size (loaderparams.initrd_filename);
if (initrd_size > 0) {
- initrd_offset = (loaderparams.ram_low_size - initrd_size
+ /* The kernel allocates the bootmap memory in the low memory after
+ the initrd. It takes at most 128kiB for 2GB RAM and 4kiB
+ pages. */
+ initrd_offset = (loaderparams.ram_low_size - initrd_size - 131072
- ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
if (kernel_high >= initrd_offset) {
fprintf(stderr,