]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
arm64: mm: Move KPTI helpers to mmu.c
authorKevin Brodsky <kevin.brodsky@arm.com>
Fri, 12 Sep 2025 07:39:08 +0000 (08:39 +0100)
committerWill Deacon <will@kernel.org>
Thu, 25 Sep 2025 13:47:19 +0000 (14:47 +0100)
commit200b0d25084d6e99f9f08229283b14b60a84c657
tree3b77b594b9adeeb079b9c922886503ecd70046de
parentfd2f74f8f3d3c1a524637caf5bead9757fae4332
arm64: mm: Move KPTI helpers to mmu.c

create_kpti_ng_temp_pgd() is currently defined (as an alias) in
mmu.c without matching declaration in a header; instead cpufeature.c
makes its own declaration. This is clearly not pretty, and as commit
ceca927c86e6 ("arm64: mm: Fix CFI failure due to kpti_ng_pgd_alloc
function signature") showed, it also makes it very easy for the
prototypes to go out of sync.

All this would be much simpler if kpti_install_ng_mappings() and
associated functions lived in mmu.c, where they logically belong.
This is what this patch does:
- Move kpti_install_ng_mappings() and associated functions from
  cpufeature.c to mmu.c, add a declaration to <asm/mmu.h>
- Remove create_kpti_ng_temp_pgd() and just call
  __create_pgd_mapping_locked() directly instead
- Mark all these functions __init
- Move __initdata after kpti_ng_temp_alloc (as suggested by
  checkpatch)

Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
[will: Fix conflicts with init_idmap_kpti_bbml2_flag()]
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/mmu.h
arch/arm64/kernel/cpufeature.c
arch/arm64/mm/mmu.c