linux-stable/arch/riscv/mm
Nick Kossifidis 148faea978 RISC-V: relocate DTB if it's outside memory region
commit c6fe81191b upstream.

In case the DTB provided by the bootloader/BootROM is before the kernel
image or outside /memory, we won't be able to access it through the
linear mapping, and get a segfault on setup_arch(). Currently OpenSBI
relocates DTB but that's not always the case (e.g. if FW_JUMP_FDT_ADDR
is not specified), and it's also not the most portable approach since
the default FW_JUMP_FDT_ADDR of the generic platform relocates the DTB
at a specific offset that may not be available. To avoid this situation
copy DTB so that it's visible through the linear mapping.

Signed-off-by: Nick Kossifidis <mick@ics.forth.gr>
Link: https://lore.kernel.org/r/20220322132839.3653682-1-mick@ics.forth.gr
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Fixes: f105aa940e ("riscv: add BUILTIN_DTB support for MMU-enabled targets")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-12 12:30:04 +02:00
..
cacheflush.c riscv: Flush current cpu icache before other cpus 2021-10-04 18:24:15 -07:00
context.c riscv: add ASID-based tlbflushing methods 2021-06-30 20:55:39 -07:00
extable.c riscv: abstract out CSR names for supervisor vs machine mode 2019-11-05 09:20:42 -08:00
fault.c riscv: Enable KFENCE for riscv64 2021-06-30 20:55:41 -07:00
hugetlbpage.c hugetlbfs: remove hugetlb_add_hstate() warning for existing hstate 2020-06-03 20:09:46 -07:00
init.c RISC-V: relocate DTB if it's outside memory region 2022-05-12 12:30:04 +02:00
kasan_init.c riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP 2022-03-08 19:12:42 +01:00
Makefile riscv: Fix config KASAN && DEBUG_VIRTUAL 2022-03-08 19:12:42 +01:00
pageattr.c RISC-V Patches for the 5.11 Merge Window, Part 1 2020-12-18 10:43:07 -08:00
physaddr.c riscv: Introduce structure that group all variables regarding kernel mapping 2021-07-05 18:04:00 -07:00
ptdump.c riscv: Fix PTDUMP output now BPF region moved back to module region 2021-07-06 15:21:27 -07:00
tlbflush.c riscv: add ASID-based tlbflushing methods 2021-06-30 20:55:39 -07:00