[PATCH v4 05/11] riscv: mm: Add pfn_to_kaddr() implementation
Björn Töpel
bjorn at kernel.org
Wed Jun 5 04:40:48 PDT 2024
From: Björn Töpel <bjorn at rivosinc.com>
The pfn_to_kaddr() function is used by KASAN's memory hotplugging
path. Add the missing function to the RISC-V port, so that it can be
built with MHP and CONFIG_KASAN.
Signed-off-by: Björn Töpel <bjorn at rivosinc.com>
---
arch/riscv/include/asm/page.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 115ac98b8d72..235fd45d998d 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -188,6 +188,11 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
unsigned long kaslr_offset(void);
+static __always_inline void *pfn_to_kaddr(unsigned long pfn)
+{
+ return __va(pfn << PAGE_SHIFT);
+}
+
#endif /* __ASSEMBLY__ */
#define virt_addr_valid(vaddr) ({ \
--
2.43.0
More information about the linux-riscv
mailing list