[PATCH v5 3/5] liveupdate: kho_block: include linux/mm.h for virt/phys translation
From: George Guo
Date: Fri Sep 04 2026 - 06:23:53 EST
From: George Guo <guodongtai@xxxxxxxxxx>
kho_block.c calls virt_to_phys() and phys_to_virt(). On LoongArch with
CONFIG_KFENCE=y, these macros (in arch/loongarch/include/asm/io.h) expand
to offset_in_page() and page_address(), both declared in <linux/mm.h>.
Since kho_block.c does not include <linux/mm.h>, the translation unit
fails to build with CONFIG_KFENCE=y:
asm/io.h: error: implicit declaration of function 'offset_in_page'
asm/io.h: error: implicit declaration of function 'page_address'
Add the missing include to fix these build errors.
This is the same root cause as the luo_session.c build fix previously
acked by Mike Rapoport [1]; the virt_to_phys()/phys_to_virt() calls have
since been refactored from luo_session.c into kho_block.c, so the fix
moves with it.
[1] https://lore.kernel.org/r/ai5nYlbERQBXRHSp@xxxxxxxxxx/
Co-developed-by: Kexin Liu <liukexin@xxxxxxxxxx>
Signed-off-by: Kexin Liu <liukexin@xxxxxxxxxx>
Signed-off-by: George Guo <guodongtai@xxxxxxxxxx>
---
kernel/liveupdate/kho_block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/liveupdate/kho_block.c b/kernel/liveupdate/kho_block.c
index 0d2a342ef422..0d56891b2f4c 100644
--- a/kernel/liveupdate/kho_block.c
+++ b/kernel/liveupdate/kho_block.c
@@ -25,6 +25,7 @@
#include <linux/kho/abi/block.h>
#include <linux/kho_block.h>
#include <linux/slab.h>
+#include <linux/mm.h>
/*
* Safeguard limit for the number of serialization blocks. This is used to
--
2.53.0