1 From c5a771d0678f9613e9f89cf1a5bdcfa5b08b225b Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Sun, 9 Jun 2013 04:52:11 +0400
4 Subject: xtensa: adjust boot parameters address when INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is selected
6 From: Max Filippov <jcmvbkbc@gmail.com>
8 commit c5a771d0678f9613e9f89cf1a5bdcfa5b08b225b upstream.
10 The virtual address of boot parameters chain is passed to the kernel via
11 a2 register. Adjust it in case it is remapped during MMUv3 -> MMUv2
12 mapping change, i.e. when it is in the first 128M.
14 Also fix interpretation of initrd and FDT addresses passed in the boot
15 parameters: these are physical addresses.
17 Reported-by: Baruch Siach <baruch@tkos.co.il>
18 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
19 Signed-off-by: Chris Zankel <chris@zankel.net>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 arch/xtensa/kernel/head.S | 9 +++++++++
24 arch/xtensa/kernel/setup.c | 6 +++---
25 2 files changed, 12 insertions(+), 3 deletions(-)
27 --- a/arch/xtensa/kernel/head.S
28 +++ b/arch/xtensa/kernel/head.S
29 @@ -68,6 +68,15 @@ _SetupMMU:
31 #ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
33 +#if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
43 .end no-absolute-literals
45 --- a/arch/xtensa/kernel/setup.c
46 +++ b/arch/xtensa/kernel/setup.c
47 @@ -152,8 +152,8 @@ static int __init parse_tag_initrd(const
50 mi = (meminfo_t*)(tag->data);
51 - initrd_start = (void*)(mi->start);
52 - initrd_end = (void*)(mi->end);
53 + initrd_start = __va(mi->start);
54 + initrd_end = __va(mi->end);
58 @@ -164,7 +164,7 @@ __tagtable(BP_TAG_INITRD, parse_tag_init
60 static int __init parse_tag_fdt(const bp_tag_t *tag)
62 - dtb_start = (void *)(tag->data[0]);
63 + dtb_start = __va(tag->data[0]);