* [PATCH 1/2] riscv: move kaslr_offset() to page.h as a static inline function
@ 2026-02-11 4:47 Austin Kim
2026-02-13 0:44 ` Paul Walmsley
0 siblings, 1 reply; 2+ messages in thread
From: Austin Kim @ 2026-02-11 4:47 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: linux-kernel, linux-riscv, austindh.kim, austin.kim
From: Austin Kim <austin.kim@lge.com>
The kaslr_offset() function is a simple accessor that returns
kernel_map.virt_offset. This commit change also ensures that kaslr_offset()
is consistently available across various kernel configurations without
requiring explicit linkage to mm/init.c.
Signed-off-by: Austin Kim <austin.kim@lge.com>
---
arch/riscv/include/asm/page.h | 5 ++++-
arch/riscv/mm/init.c | 5 -----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 187aad0a7..813b6da57 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -190,7 +190,10 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
#define sym_to_pfn(x) __phys_to_pfn(__pa_symbol(x))
-unsigned long kaslr_offset(void);
+static inline unsigned long kaslr_offset(void)
+{
+ return kernel_map.virt_offset;
+}
static __always_inline void *pfn_to_kaddr(unsigned long pfn)
{
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 811e03786..257df6bd2 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -1078,11 +1078,6 @@ static int __init print_nokaslr(char *p)
return 0;
}
early_param("nokaslr", print_nokaslr);
-
-unsigned long kaslr_offset(void)
-{
- return kernel_map.virt_offset;
-}
#endif
asmlinkage void __init setup_vm(uintptr_t dtb_pa)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] riscv: move kaslr_offset() to page.h as a static inline function
2026-02-11 4:47 [PATCH 1/2] riscv: move kaslr_offset() to page.h as a static inline function Austin Kim
@ 2026-02-13 0:44 ` Paul Walmsley
0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2026-02-13 0:44 UTC (permalink / raw)
To: Austin Kim
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
linux-kernel, linux-riscv, austin.kim
On Wed, 11 Feb 2026, Austin Kim wrote:
> From: Austin Kim <austin.kim@lge.com>
>
> The kaslr_offset() function is a simple accessor that returns
> kernel_map.virt_offset. This commit change also ensures that kaslr_offset()
> is consistently available across various kernel configurations without
> requiring explicit linkage to mm/init.c.
>
> Signed-off-by: Austin Kim <austin.kim@lge.com>
Thanks, queued for v7.0-rc.
- Paul
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-13 0:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-11 4:47 [PATCH 1/2] riscv: move kaslr_offset() to page.h as a static inline function Austin Kim
2026-02-13 0:44 ` Paul Walmsley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox