From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 2/3] arm64: add the initrd region to the linear mapping explicitly
Date: Tue, 2 Feb 2016 18:56:41 +0100 [thread overview]
Message-ID: <1454435802-7604-3-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1454435802-7604-1-git-send-email-ard.biesheuvel@linaro.org>
Instead of going out of our way to relocate the initrd if it turns out
to occupy memory that is not covered by the linear mapping, just add the
initrd to the linear mapping. This puts the burden on the bootloader to
pass initrd= and mem= options that are mutually consistent.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm64/mm/init.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index f3b061e67bfe..5dd083161810 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -167,8 +167,20 @@ void __init arm64_memblock_init(void)
*/
memblock_reserve(__pa(_text), _end - _text);
#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start);
+ if (initrd_start) {
+ u64 base = __virt_to_phys(initrd_start);
+ u64 size = initrd_end - initrd_start;
+
+ /*
+ * The initrd needs to be accessible via the linear mapping. So
+ * add the memory covered by the initrd explicitly, since it may
+ * have been clipped or otherwise left out when we traversed the
+ * DT memory nodes or the UEFI memory map.
+ */
+ memblock_add(base, size);
+ memblock_clear_nomap(base, size);
+ memblock_reserve(base, size);
+ }
#endif
early_init_fdt_scan_reserved_mem();
--
2.5.0
next prev parent reply other threads:[~2016-02-02 17:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 17:56 [RFC PATCH 0/3] arm64 initrd mapping/relocation Ard Biesheuvel
2016-02-02 17:56 ` [RFC PATCH 1/3] memblock: add routine to clear the MEMBLOCK_NOMAP flag for a region Ard Biesheuvel
2016-02-02 17:56 ` Ard Biesheuvel [this message]
2016-02-02 17:56 ` [RFC PATCH 3/3] arm64: remove the now unneeded relocate_initrd() Ard Biesheuvel
2016-02-02 18:06 ` [RFC PATCH 0/3] arm64 initrd mapping/relocation Will Deacon
2016-02-02 21:39 ` Mark Langsdorf
2016-02-03 14:22 ` Mark Salter
2016-02-03 14:26 ` Ard Biesheuvel
2016-02-08 16:17 ` Jeremy Linton
2016-02-02 21:39 ` Mark Langsdorf
2016-02-03 8:42 ` Ard Biesheuvel
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=1454435802-7604-3-git-send-email-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).