From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: Mark Rutland <mark.rutland@arm.com>,
Richard Henderson <richard.henderson@linaro.org>
Subject: [Qemu-devel] [PATCH for-4.1? 0/2] arm: further improve initrd positioning
Date: Mon, 22 Jul 2019 16:18:02 +0100 [thread overview]
Message-ID: <20190722151804.25467-1-peter.maydell@linaro.org> (raw)
In commit e6b2b20d9735d4ef we made the boot loader code try to avoid
putting the initrd on top of the kernel. However the expression used
to calculate the start of the initrd:
info->initrd_start = info->loader_start +
MAX(MIN(info->ram_size / 2, 128 * 1024 * 1024), kernel_size);
incorrectly uses 'kernel_size' as the offset within RAM of the
highest address to avoid. This is incorrect because the kernel
doesn't start at address 0, but slightly higher than that. This
means that we can still incorrectly end up overlaying the initrd on
the kernel in some cases, for example:
* The kernel's image_size is 0x0a7a8000
* The kernel was loaded at 0x40080000
* The end of the kernel is 0x4A828000
* The DTB was loaded at 0x4a800000
To get this right we need to track the actual highest address used
by the kernel and use that rather than kernel_size. We already
trace the low_addr and high_addr for ELF images; set them
also for the various other image types we support, and then use
high_addr as the lowest allowed address for the initrd.
Patch 1 just does a preliminary variable rename; patch 2 is the meat.
Only very lightly tested...
Marked as 'maybe for 4.1' because it is a bug fix and to code which
is new in 4.1. OTOH cases that fail now would have failed with 4.0
so it is not a regression strictly speaking. And we're getting
steadily closer to release and I haven't very heavily tested this
patch. I incline towards including it, overall.
thanks
-- PMM
Peter Maydell (2):
hw/arm/boot: Rename elf_{low,high}_addr to image_{low,high}_addr
hw/arm/boot: Further improve initrd positioning code
hw/arm/boot.c | 37 +++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)
--
2.20.1
next reply other threads:[~2019-07-22 15:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 15:18 Peter Maydell [this message]
2019-07-22 15:18 ` [Qemu-devel] [PATCH for-4.1? 1/2] hw/arm/boot: Rename elf_{low, high}_addr to image_{low, high}_addr Peter Maydell
2019-07-26 10:04 ` [Qemu-devel] [Qemu-arm] " Alex Bennée
2019-07-26 10:16 ` Alex Bennée
2019-07-26 11:09 ` [Qemu-devel] " Philippe Mathieu-Daudé
2019-07-22 15:18 ` [Qemu-devel] [PATCH for-4.1? 2/2] hw/arm/boot: Further improve initrd positioning code Peter Maydell
2019-07-26 10:23 ` Alex Bennée
2019-07-22 16:52 ` [Qemu-devel] [PATCH for-4.1? 0/2] arm: further improve initrd positioning Mark Rutland
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=20190722151804.25467-1-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=mark.rutland@arm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).