Skip to content

Commit 66f962d

Browse files
Alexandre Ghitipalmer-dabbelt
authored andcommitted
riscv: Fix build error on rv32 + XIP
commit 66f1e68 ("riscv: Make XIP bootable again") restricted page offset to the sv39 page offset instead of the default sv57, which makes sense since probably the platforms that target XIP kernels do not support anything else than sv39 and we do not try to find out the largest address space supported on XIP kernels (ie set_satp_mode()). But PAGE_OFFSET_L3 is not defined for rv32, so fix the build error by restoring the previous behaviour which picks CONFIG_PAGE_OFFSET for rv32. Fixes: 66f1e68 ("riscv: Make XIP bootable again") Reported-by: Randy Dunlap <rdunlap@infradead.org> Closes: https://lore.kernel.org/linux-riscv/344dca85-5c48-44e1-bc64-4fa7973edd12@infradead.org/T/#u Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Link: https://lore.kernel.org/r/20240118212120.2087803-1-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 080c432 commit 66f962d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/riscv/mm/init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,11 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
10601060
kernel_map.virt_addr = KERNEL_LINK_ADDR + kernel_map.virt_offset;
10611061

10621062
#ifdef CONFIG_XIP_KERNEL
1063+
#ifdef CONFIG_64BIT
10631064
kernel_map.page_offset = PAGE_OFFSET_L3;
1065+
#else
1066+
kernel_map.page_offset = _AC(CONFIG_PAGE_OFFSET, UL);
1067+
#endif
10641068
kernel_map.xiprom = (uintptr_t)CONFIG_XIP_PHYS_ADDR;
10651069
kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom);
10661070

0 commit comments

Comments
 (0)