From: Austin Kim <austindh.kim@gmail.com>
To: Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
austindh.kim@gmail.com, austin.kim@lge.com
Subject: [PATCH 1/2] riscv: move kaslr_offset() to page.h as a static inline function
Date: Wed, 11 Feb 2026 13:47:43 +0900 [thread overview]
Message-ID: <aYwJ76yHaMbbQVJA@adminpc-PowerEdge-R7525> (raw)
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
next reply other threads:[~2026-02-11 4:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 4:47 Austin Kim [this message]
2026-02-13 0:44 ` [PATCH 1/2] riscv: move kaslr_offset() to page.h as a static inline function Paul Walmsley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aYwJ76yHaMbbQVJA@adminpc-PowerEdge-R7525 \
--to=austindh.kim@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=austin.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox