riscv: move kaslr_offset() to page.h as a static inline function

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>
Link: https://patch.msgid.link/aYwJ76yHaMbbQVJA@adminpc-PowerEdge-R7525
Signed-off-by: Paul Walmsley <pjw@kernel.org>
master
Austin Kim 2026-04-04 18:42:40 -06:00 committed by Paul Walmsley
parent 31454cb5f1
commit ce3a360a6d
2 changed files with 4 additions and 6 deletions

View File

@ -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)
{

View File

@ -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)