From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: <ralf@linux-mips.org>, <paul.burton@mips.com>,
<jhogan@kernel.org>, <linux-mips@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Subject: [Resend] arch: mips: Fix initrd_start and initrd_end when read from DT
Date: Tue, 16 Apr 2019 12:18:20 +0200 [thread overview]
Message-ID: <1555409900-31278-1-git-send-email-horatiu.vultur@microchip.com> (raw)
When the bootloader passes arguments to linux kernel through device tree,
it passes the address of initrd_start and initrd_stop, which are in kseg0.
But when linux kernel reads these addresses from device tree, it converts
them to virtual addresses inside the function
__early_init_dt_declare_initrd.
At a later point then in the function init_initrd, it is checking for
initrd_start to be lower than PAGE_OFFSET, which for a 32 CPU it is not,
therefore it would disable the initrd by setting 0 to initrd_start and
initrd_stop.
The fix consists of checking if linux kernel received a device tree and not
having enable extended virtual address and in that case convert them back
to physical addresses that point in kseg0 as expected.
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
arch/mips/kernel/setup.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8d1dc6c..774ee00 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -264,6 +264,17 @@ static unsigned long __init init_initrd(void)
pr_err("initrd start must be page aligned\n");
goto disable;
}
+
+ /*
+ * In case the initrd_start and initrd_end are read from DT,
+ * then they are converted to virtual address, therefore convert
+ * them back to physical address.
+ */
+ if (!IS_ENABLED(CONFIG_EVA) && fw_arg0 == -2) {
+ initrd_start = initrd_start - PAGE_OFFSET + PHYS_OFFSET;
+ initrd_end = initrd_end - PAGE_OFFSET + PHYS_OFFSET;
+ }
+
if (initrd_start < PAGE_OFFSET) {
pr_err("initrd start < PAGE_OFFSET\n");
goto disable;
--
2.7.4
next reply other threads:[~2019-04-16 10:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 10:18 Horatiu Vultur [this message]
2019-04-19 20:55 ` Paul Burton
2019-04-24 12:12 ` Horatiu Vultur
2019-04-24 21:36 ` Paul Burton
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=1555409900-31278-1-git-send-email-horatiu.vultur@microchip.com \
--to=horatiu.vultur@microchip.com \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.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
all inboxes | Powered by JetHome®