diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2018-11-14 02:46:42 -0500 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2018-11-14 03:15:32 -0500 |
commit | 40dc948f234b73497c3278875eb08a01d5854d3f (patch) | |
tree | 475126b58c8d9ba2dcd700c1f396282021ed5b23 | |
parent | 0773495b1f5f1c5e23551843f87b5ff37e7af8f7 (diff) |
xtensa: fix boot parameters address translation
The bootloader may pass physical address of the boot parameters structure
to the MMUv3 kernel in the register a2. Code in the _SetupMMU block in
the arch/xtensa/kernel/head.S is supposed to map that physical address to
the virtual address in the configured virtual memory layout.
This code haven't been updated when additional 256+256 and 512+512
memory layouts were introduced and it may produce wrong addresses when
used with these layouts.
Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
-rw-r--r-- | arch/xtensa/kernel/head.S | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S index 2f76118ecf62..9053a5622d2c 100644 --- a/arch/xtensa/kernel/head.S +++ b/arch/xtensa/kernel/head.S | |||
@@ -88,9 +88,12 @@ _SetupMMU: | |||
88 | initialize_mmu | 88 | initialize_mmu |
89 | #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY | 89 | #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY |
90 | rsr a2, excsave1 | 90 | rsr a2, excsave1 |
91 | movi a3, 0x08000000 | 91 | movi a3, XCHAL_KSEG_PADDR |
92 | bltu a2, a3, 1f | ||
93 | sub a2, a2, a3 | ||
94 | movi a3, XCHAL_KSEG_SIZE | ||
92 | bgeu a2, a3, 1f | 95 | bgeu a2, a3, 1f |
93 | movi a3, 0xd0000000 | 96 | movi a3, XCHAL_KSEG_CACHED_VADDR |
94 | add a2, a2, a3 | 97 | add a2, a2, a3 |
95 | wsr a2, excsave1 | 98 | wsr a2, excsave1 |
96 | 1: | 99 | 1: |