Skip to content

Commit ed50da7

Browse files
author
James Morse
committed
arm64: entry: Don't assume tramp_vectors is the start of the vectors
The tramp_ventry macro uses tramp_vectors as the address of the vectors when calculating which ventry in the 'full fat' vectors to branch to. While there is one set of tramp_vectors, this will be true. Adding multiple sets of vectors will break this assumption. Move the generation of the vectors to a macro, and pass the start of the vectors as an argument to tramp_ventry. Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: James Morse <james.morse@arm.com>
1 parent 6c5bf79 commit ed50da7

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

arch/arm64/kernel/entry.S

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ alternative_else_nop_endif
652652
sub \dst, \dst, PAGE_SIZE
653653
.endm
654654

655-
.macro tramp_ventry, regsize = 64
655+
.macro tramp_ventry, vector_start, regsize
656656
.align 7
657657
1:
658658
.if \regsize == 64
@@ -675,10 +675,10 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003
675675
ldr x30, =vectors
676676
#endif
677677
alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM
678-
prfm plil1strm, [x30, #(1b - tramp_vectors)]
678+
prfm plil1strm, [x30, #(1b - \vector_start)]
679679
alternative_else_nop_endif
680680
msr vbar_el1, x30
681-
add x30, x30, #(1b - tramp_vectors + 4)
681+
add x30, x30, #(1b - \vector_start + 4)
682682
isb
683683
ret
684684
.org 1b + 128 // Did we overflow the ventry slot?
@@ -697,19 +697,21 @@ alternative_else_nop_endif
697697
sb
698698
.endm
699699

700-
.align 11
701-
SYM_CODE_START_NOALIGN(tramp_vectors)
700+
.macro generate_tramp_vector
701+
.Lvector_start\@:
702702
.space 0x400
703703

704-
tramp_ventry
705-
tramp_ventry
706-
tramp_ventry
707-
tramp_ventry
704+
.rept 4
705+
tramp_ventry .Lvector_start\@, 64
706+
.endr
707+
.rept 4
708+
tramp_ventry .Lvector_start\@, 32
709+
.endr
710+
.endm
708711

709-
tramp_ventry 32
710-
tramp_ventry 32
711-
tramp_ventry 32
712-
tramp_ventry 32
712+
.align 11
713+
SYM_CODE_START_NOALIGN(tramp_vectors)
714+
generate_tramp_vector
713715
SYM_CODE_END(tramp_vectors)
714716

715717
SYM_CODE_START(tramp_exit_native)

0 commit comments

Comments
 (0)