linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: takahiro.akashi@linaro.org (AKASHI Takahiro)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] fixup! arm64: allow kernel Image to be loaded anywhere in physical memory
Date: Fri, 22 May 2015 14:43:07 +0900	[thread overview]
Message-ID: <1432273387-7385-1-git-send-email-takahiro.akashi@linaro.org> (raw)
In-Reply-To: <1431328388-3051-1-git-send-email-ard.biesheuvel@linaro.org>

Ard,

In testing my kexec/dump code, I found that your patch doesn't work
with initrd. Since the virtual addresses of initrd are calc'ed earlier
than map_mem(), they have bogus values and unpack_to_rootfs() will fail.

This patch fixes the issue.
Please think of taking it in your next version.
---
 arch/arm64/mm/mmu.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 7e3e6af..43c2317 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -21,6 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
+#include <linux/initrd.h>
 #include <linux/libfdt.h>
 #include <linux/mman.h>
 #include <linux/nodemask.h>
@@ -452,6 +453,13 @@ static void __init map_mem(void)
 	bootstrap_linear_mapping(new_va_offset);
 
 	kernel_va_offset = new_va_offset;
+
+	/* Recalculate virtual addresses of initrd region */
+	if (initrd_start) {
+		initrd_start += new_va_offset;
+		initrd_end += new_va_offset;
+	}
+
 	memstart_addr = new_memstart_addr;
 
 	/* map all the memory banks */
-- 
1.7.9.5

  parent reply	other threads:[~2015-05-22  5:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11  7:12 [PATCH 00/10] arm64: relax Image placement rules Ard Biesheuvel
2015-05-11  7:12 ` [PATCH 01/10] arm64/efi: use dynamically allocated space for EFI pgd Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 02/10] arm64: reduce ID map to a single page Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 03/10] arm64: drop sleep_idmap_phys and clean up cpu_resume() Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 04/10] arm64: use more granular reservations for static page table allocations Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 05/10] arm64: split off early mapping code from early_fixmap_init() Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 06/10] arm64: mm: explicitly bootstrap the linear mapping Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 07/10] arm64: move kernel mapping out of linear region Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 08/10] arm64: map linear region as non-executable Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 09/10] arm64: allow kernel Image to be loaded anywhere in physical memory Ard Biesheuvel
2015-05-11  7:13 ` [PATCH 10/10] arm64/efi: adapt to relaxed kernel Image placement requirements Ard Biesheuvel
2015-05-22  5:43 ` AKASHI Takahiro [this message]
2015-05-22  6:34   ` [PATCH] fixup! arm64: allow kernel Image to be loaded anywhere in physical memory 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=1432273387-7385-1-git-send-email-takahiro.akashi@linaro.org \
    --to=takahiro.akashi@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).