From: Yongbok Kim <yongbok.kim@imgtec.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PULL 2/8] mips/malta: leave space for the bootmap after the initrd
Date: Thu, 3 Aug 2017 15:45:09 +0100 [thread overview]
Message-ID: <1501771515-22847-3-git-send-email-yongbok.kim@imgtec.com> (raw)
In-Reply-To: <1501771515-22847-1-git-send-email-yongbok.kim@imgtec.com>
From: Aurelien Jarno <aurelien@aurel32.net>
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>
---
hw/mips/mips_malta.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 8ecd544..9dcec27 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,
--
2.7.4
next prev parent reply other threads:[~2017-08-03 14:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 14:45 [Qemu-devel] [PULL 0/8] target-mips queue Yongbok Kim
2017-08-03 14:45 ` [Qemu-devel] [PULL 1/8] target-mips: Don't stop on [d]mtc0 DESAVE/KScratch Yongbok Kim
2017-08-03 14:45 ` Yongbok Kim [this message]
2017-08-03 14:45 ` [Qemu-devel] [PULL 3/8] mips: Improve segment defs for KVM T&E guests Yongbok Kim
2017-08-03 14:45 ` [Qemu-devel] [PULL 4/8] mips: Add KVM T&E segment support for TCG Yongbok Kim
2017-08-03 14:45 ` [Qemu-devel] [PULL 5/8] target-mips: apply CP0.PageMask before writing into TLB entry Yongbok Kim
2017-08-03 14:45 ` [Qemu-devel] [PULL 6/8] target/mips: Use BS_EXCP where interrupts are expected Yongbok Kim
2017-08-03 14:45 ` [Qemu-devel] [PULL 7/8] target/mips: Drop redundant gen_io_start/stop() Yongbok Kim
2017-08-03 14:45 ` [Qemu-devel] [PULL 8/8] target/mips: Fix RDHWR CC with icount Yongbok Kim
2017-08-04 12:46 ` [Qemu-devel] [PULL 0/8] target-mips queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1501771515-22847-3-git-send-email-yongbok.kim@imgtec.com \
--to=yongbok.kim@imgtec.com \
--cc=aurelien@aurel32.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).