arm64: Use mov_q to load KPTI_NG_PTE_FLAGS/SWAPPER_R*_MMUFLAGS
PATCH 1/1 arm64: Use mov_q to load KPTI_NG_PTE_FLAGS/SWAPPER_R*_MMUFLAGS
With f7b4c3b82e7d ("arm64: set UXN on swapper page tables"), the kernel fails to build:
arch/arm64/kernel/head.S: Assembler messages:arch/arm64/kernel/head.S:334: Error: immediate cannot be moved by a single instruction arch/arm64/kernel/head.S:343: Error: immediate cannot be moved by a single instruction arch/arm64/kernel/head.S:354: Error: immediate cannot be moved by a single instruction arch/arm64/kernel/head.S:379: Error: immediate cannot be moved by a single instruction
as the constants that inherit SWAPPER_P*_FLAGS cannot be loaded using a single 'mov' instruction. Move over to mov_q to fix this.
--- arch/arm64/kernel/head.S | 8 ++++---- arch/arm64/mm/proc.S | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm64/kernel/head.S +4 -4
@@ -331,7 +331,7 @@ SYM_FUNC_START_LOCAL(create_idmap) adrp x0, init_idmap_pg_dir adrp x3, _text adrp x6, _end + MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE - mov x7, SWAPPER_RX_MMUFLAGS + mov_q x7, SWAPPER_RX_MMUFLAGS map_memory x0, x1, x3, x6, x7, x3, IDMAP_PGD_ORDER, x10, x11, x12, x13, x14, EXTRA_SHIFT
@@ -340,7 +340,7 @@ SYM_FUNC_START_LOCAL(create_idmap) adrp x2, init_pg_dir adrp x3, init_pg_end bic x4, x2, #SWAPPER_BLOCK_SIZE - 1 - mov x5, SWAPPER_RW_MMUFLAGS + mov_q x5, SWAPPER_RW_MMUFLAGS mov x6, #SWAPPER_BLOCK_SHIFT bl remap_region
@@ -351,7 +351,7 @@ SYM_FUNC_START_LOCAL(create_idmap) bfi x22, x21, #0, #SWAPPER_BLOCK_SHIFT // remapped FDT address add x3, x2, #MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE bic x4, x21, #SWAPPER_BLOCK_SIZE - 1 - mov x5, SWAPPER_RW_MMUFLAGS + mov_q x5, SWAPPER_RW_MMUFLAGS mov x6, #SWAPPER_BLOCK_SHIFT bl remap_region
@@ -376,7 +376,7 @@ SYM_FUNC_START_LOCAL(create_kernel_mapping) adrp x3, _text // runtime __pa(_text) sub x6, x6, x3 // _end - _text add x6, x6, x5 // runtime __va(_end) - mov x7, SWAPPER_RW_MMUFLAGS + mov_q x7, SWAPPER_RW_MMUFLAGS map_memory x0, x1, x5, x6, x7, x3, (VA_BITS - PGDIR_SHIFT), x10, x11, x12, x13, x14
arch/arm64/mm/proc.S +1 -1
@@ -293,7 +293,7 @@ SYM_FUNC_START(idmap_kpti_install_ng_mappings) isb mov temp_pte, x5 - mov pte_flags, #KPTI_NG_PTE_FLAGS + mov_q pte_flags, KPTI_NG_PTE_FLAGS /* Everybody is enjoying the idmap, so we can rewrite swapper. */ /* PGD */
Signature · 7 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Catalin Marinas
maintainerQuoted 9 lines · Marc Zyngier
With
f7b4c3b82e7d("arm64: set UXN on swapper page tables"), the kernel fails to build:
arch/arm64/kernel/head.S: Assembler messages:arch/arm64/kernel/head.S:334: Error: immediate cannot be moved by a single instructionarch/arm64/kernel/head.S:343: Error: immediate cannot be moved by a single instructionarch/arm64/kernel/head.S:354: Error: immediate cannot be moved by a single instructionarch/arm64/kernel/head.S:379: Error: immediate cannot be moved by a single instruction
Quoted 4 lines
as the constants that inherit SWAPPER_P*_FLAGS cannot be loaded using a single 'mov' instruction. Move over to
mov_qto fix this.Signed-off-by Marc Zyngier <[email protected]>
Thanks for the fix Marc, this only applies to -next. We could either revert Peter's patch [1] in -next but keep it for 5.19 or simply drop it from for-next/fixes and send it to stable post 5.19. I'm more inclined to do the latter.
Catalin
[1] https://lore.kernel.org/r/[email protected]
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 14 lines · Catalin Marinas
Quoted 12 lines · Marc Zyngier
With
f7b4c3b82e7d("arm64: set UXN on swapper page tables"), the kernel fails to build:
arch/arm64/kernel/head.S: Assembler messages:arch/arm64/kernel/head.S:334: Error: immediate cannot be moved by a single instructionarch/arm64/kernel/head.S:343: Error: immediate cannot be moved by a single instructionarch/arm64/kernel/head.S:354: Error: immediate cannot be moved by a single instructionarch/arm64/kernel/head.S:379: Error: immediate cannot be moved by a single instructionas the constants that inherit SWAPPER_P*_FLAGS cannot be loaded using a single 'mov' instruction. Move over to
mov_qto fix this.
Quoted 6 lines
Quoted 1 line
Signed-off-by Marc Zyngier <[email protected]>Thanks for the fix Marc, this only applies to -next. We could either revert Peter's patch [1] in -next but keep it for 5.19 or simply drop it from for-next/fixes and send it to stable post 5.19. I'm more inclined to do the latter.
Agreed, this seems like a sensible decision. This is unlikely to affect a large user base at this stage anyway.
Thanks,
M.
Signature · 6 lines
Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel