Skip to content

Commit 7ee74cc

Browse files
ardbiesheuvelMarc Zyngier
authored andcommitted
KVM: arm64: Avoid unnecessary absolute addressing via literals
There are a few cases in the nVHE code where we take the absolute address of a symbol via a literal pool entry, and subsequently translate it to another address space (PA, kimg VA, kernel linear VA, etc). Originally, this literal was needed because we relied on a different translation for absolute references, but this is no longer the case, so we can simply use relative addressing instead. This removes a couple of RELA entries pointing into the .text segment. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220428140350.3303481-1-ardb@kernel.org
1 parent 325031d commit 7ee74cc

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

arch/arm64/kvm/hyp/nvhe/host.S

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ SYM_FUNC_START(__hyp_do_panic)
8080
mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\
8181
PSR_MODE_EL1h)
8282
msr spsr_el2, lr
83-
ldr lr, =nvhe_hyp_panic_handler
83+
adr_l lr, nvhe_hyp_panic_handler
8484
hyp_kimg_va lr, x6
8585
msr elr_el2, lr
8686

@@ -125,13 +125,11 @@ alternative_else_nop_endif
125125
add sp, sp, #16
126126
/*
127127
* Compute the idmap address of __kvm_handle_stub_hvc and
128-
* jump there. Since we use kimage_voffset, do not use the
129-
* HYP VA for __kvm_handle_stub_hvc, but the kernel VA instead
130-
* (by loading it from the constant pool).
128+
* jump there.
131129
*
132130
* Preserve x0-x4, which may contain stub parameters.
133131
*/
134-
ldr x5, =__kvm_handle_stub_hvc
132+
adr_l x5, __kvm_handle_stub_hvc
135133
hyp_pa x5, x6
136134
br x5
137135
SYM_FUNC_END(__host_hvc)

0 commit comments

Comments
 (0)