From: Björn Töpel Date: Wed, 5 Jun 2024 11:40:48 +0000 (+0200) Subject: riscv: mm: Add pfn_to_kaddr() implementation X-Git-Tag: v6.11-rc1~94^2~7^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e6c5e21b8cbe94b89d2e848afad4e6fe2a7abd8;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Alexandre Ghiti Link: https://lore.kernel.org/r/20240605114100.315918-6-bjorn@kernel.org Signed-off-by: Palmer Dabbelt --- diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index 115ac98b8d729..235fd45d998d9 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) ({ \