summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Töpel <bjorn@rivosinc.com>2024-06-05 13:40:48 +0200
committerPalmer Dabbelt <palmer@rivosinc.com>2024-06-26 17:42:41 +0200
commit6e6c5e21b8cbe94b89d2e848afad4e6fe2a7abd8 (patch)
tree2560ac4f07a2fcf8ac7c23f2d5d5456c8a7fd2d0
parentriscv: mm: Refactor create_linear_mapping_range() for memory hot add (diff)
downloadlinux-6e6c5e21b8cbe94b89d2e848afad4e6fe2a7abd8.tar.xz
linux-6e6c5e21b8cbe94b89d2e848afad4e6fe2a7abd8.zip
riscv: mm: Add pfn_to_kaddr() implementation
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@rivosinc.com> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Link: https://lore.kernel.org/r/20240605114100.315918-6-bjorn@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-rw-r--r--arch/riscv/include/asm/page.h5
1 files changed, 5 insertions, 0 deletions
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) ({ \