Skip to content

Commit c5a771d

Browse files
jcmvbkbcczankel
authored andcommitted
xtensa: adjust boot parameters address when INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is selected
The virtual address of boot parameters chain is passed to the kernel via a2 register. Adjust it in case it is remapped during MMUv3 -> MMUv2 mapping change, i.e. when it is in the first 128M. Also fix interpretation of initrd and FDT addresses passed in the boot parameters: these are physical addresses. Cc: stable@vger.kernel.org Reported-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Chris Zankel <chris@zankel.net>
1 parent 661b40b commit c5a771d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

arch/xtensa/kernel/head.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ _SetupMMU:
6868

6969
#ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
7070
initialize_mmu
71+
#if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
72+
rsr a2, excsave1
73+
movi a3, 0x08000000
74+
bgeu a2, a3, 1f
75+
movi a3, 0xd0000000
76+
add a2, a2, a3
77+
wsr a2, excsave1
78+
1:
79+
#endif
7180
#endif
7281
.end no-absolute-literals
7382

arch/xtensa/kernel/setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ static int __init parse_tag_initrd(const bp_tag_t* tag)
152152
{
153153
meminfo_t* mi;
154154
mi = (meminfo_t*)(tag->data);
155-
initrd_start = (void*)(mi->start);
156-
initrd_end = (void*)(mi->end);
155+
initrd_start = __va(mi->start);
156+
initrd_end = __va(mi->end);
157157

158158
return 0;
159159
}
@@ -164,7 +164,7 @@ __tagtable(BP_TAG_INITRD, parse_tag_initrd);
164164

165165
static int __init parse_tag_fdt(const bp_tag_t *tag)
166166
{
167-
dtb_start = (void *)(tag->data[0]);
167+
dtb_start = __va(tag->data[0]);
168168
return 0;
169169
}
170170

0 commit comments

Comments
 (0)