linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: Fix build error on rv32 + XIP
@ 2024-01-18 21:21 Alexandre Ghiti
  2024-01-18 21:27 ` Randy Dunlap
  2024-01-20 21:09 ` patchwork-bot+linux-riscv
  0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Ghiti @ 2024-01-18 21:21 UTC (permalink / raw)
  To: Randy Dunlap, Stephen Rothwell, Linux Next Mailing List,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Frederik Haxel,
	linux-riscv, linux-kernel
  Cc: Alexandre Ghiti

commit 66f1e6809397 ("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: 66f1e6809397 ("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>
---
 arch/riscv/mm/init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index f533dd667a83..32cad6a65ccd 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -1060,7 +1060,11 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
 	kernel_map.virt_addr = KERNEL_LINK_ADDR + kernel_map.virt_offset;
 
 #ifdef CONFIG_XIP_KERNEL
+#ifdef CONFIG_64BIT
 	kernel_map.page_offset = PAGE_OFFSET_L3;
+#else
+	kernel_map.page_offset = _AC(CONFIG_PAGE_OFFSET, UL);
+#endif
 	kernel_map.xiprom = (uintptr_t)CONFIG_XIP_PHYS_ADDR;
 	kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom);
 
-- 
2.39.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: Fix build error on rv32 + XIP
  2024-01-18 21:21 [PATCH] riscv: Fix build error on rv32 + XIP Alexandre Ghiti
@ 2024-01-18 21:27 ` Randy Dunlap
  2024-01-20 21:09 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2024-01-18 21:27 UTC (permalink / raw)
  To: Alexandre Ghiti, Stephen Rothwell, Linux Next Mailing List,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Frederik Haxel,
	linux-riscv, linux-kernel



On 1/18/24 13:21, Alexandre Ghiti wrote:
> commit 66f1e6809397 ("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: 66f1e6809397 ("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

Thanks.


> ---
>  arch/riscv/mm/init.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index f533dd667a83..32cad6a65ccd 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -1060,7 +1060,11 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
>  	kernel_map.virt_addr = KERNEL_LINK_ADDR + kernel_map.virt_offset;
>  
>  #ifdef CONFIG_XIP_KERNEL
> +#ifdef CONFIG_64BIT
>  	kernel_map.page_offset = PAGE_OFFSET_L3;
> +#else
> +	kernel_map.page_offset = _AC(CONFIG_PAGE_OFFSET, UL);
> +#endif
>  	kernel_map.xiprom = (uintptr_t)CONFIG_XIP_PHYS_ADDR;
>  	kernel_map.xiprom_sz = (uintptr_t)(&_exiprom) - (uintptr_t)(&_xiprom);
>  

-- 
#Randy

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: Fix build error on rv32 + XIP
  2024-01-18 21:21 [PATCH] riscv: Fix build error on rv32 + XIP Alexandre Ghiti
  2024-01-18 21:27 ` Randy Dunlap
@ 2024-01-20 21:09 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-01-20 21:09 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: linux-riscv, rdunlap, sfr, linux-next, paul.walmsley, palmer,
	aou, haxel, linux-kernel

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 18 Jan 2024 22:21:20 +0100 you wrote:
> commit 66f1e6809397 ("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.
> 
> [...]

Here is the summary with links:
  - riscv: Fix build error on rv32 + XIP
    https://git.kernel.org/riscv/c/66f962d8939f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-20 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18 21:21 [PATCH] riscv: Fix build error on rv32 + XIP Alexandre Ghiti
2024-01-18 21:27 ` Randy Dunlap
2024-01-20 21:09 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).