]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
LoongArch: Make {virt, phys, page, pfn} translation work with KFENCE
authorHuacai Chen <chenhuacai@loongson.cn>
Wed, 10 Apr 2024 13:08:51 +0000 (21:08 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Wed, 10 Apr 2024 13:08:51 +0000 (21:08 +0800)
commit0ca84aeaee150796d4b5577b1b0ae52a947e7813
treebdb15b18d2b672ee85f4d6be1e693d7dfb77e4a7
parent0871bc0129d403747ea0272a4384895d7ad37a6c
LoongArch: Make {virt, phys, page, pfn} translation work with KFENCE

KFENCE changes virt_to_page() to be able to translate tlb mapped virtual
addresses, but forget to change virt_to_phys()/phys_to_virt() and other
translation functions as well. This patch fix it, otherwise some drivers
(such as nvme and virtio-blk) cannot work with KFENCE.

All {virt, phys, page, pfn} translation functions are updated:
1, virt_to_pfn()/pfn_to_virt();
2, virt_to_page()/page_to_virt();
3, virt_to_phys()/phys_to_virt().

DMW/TLB mapped addresses are distinguished by comparing the vaddress
with vm_map_base in virt_to_xyz(), and we define WANT_PAGE_VIRTUAL in
the KFENCE case for the reverse translations, xyz_to_virt().

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/io.h
arch/loongarch/include/asm/kfence.h
arch/loongarch/include/asm/page.h
arch/loongarch/mm/pgtable.c