riscv/mm: Add XIP_FIXUP for phys_ram_base
authorPalmer Dabbelt <palmer@rivosinc.com>
Fri, 4 Feb 2022 21:13:37 +0000 (13:13 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Fri, 4 Feb 2022 21:18:56 +0000 (13:18 -0800)
This manifests as a crash early in boot on VexRiscv.

Signed-off-by: Myrtle Shah <gatecat@ds0.me>
[Palmer: split commit]
Fixes: 6d7f91d914bc ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/mm/init.c

index cf4d018b7d668fc442aab4e08ad6f98d7aca972f..eecfacac2cc51dc8c5f18f7da2b976fd76ad4641 100644 (file)
@@ -522,6 +522,7 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size)
 }
 
 #ifdef CONFIG_XIP_KERNEL
+#define phys_ram_base  (*(phys_addr_t *)XIP_FIXUP(&phys_ram_base))
 extern char _xiprom[], _exiprom[], __data_loc;
 
 /* called from head.S with MMU off */