Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: decompressor: Remove __hyp_get_vectors usage

When the compressed image needs to be relocated to avoid being
overwritten by the decompression process, we need to relocate
the hyp vectors as well so that we can find them once the
decompression has taken effect.

For that, we perform the following calculation:
u32 v = __hyp_get_vectors();
v += offset;
__hyp_set_vectors(v);

But we're guaranteed that the initial value of v as returned by
__hyp_get_vectors is always __hyp_stub_vectors, because we have
just set it by calling __hyp_stub_install.

So let's remove the use of __hyp_get_vectors, and directly use
__hyp_stub_vectors instead.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>

authored by

Marc Zyngier and committed by
Christoffer Dall
4897e36c 47eb3cba

+11 -1
+11 -1
arch/arm/boot/compressed/head.S
··· 422 422 cmp r0, #HYP_MODE 423 423 bne 1f 424 424 425 - bl __hyp_get_vectors 425 + /* 426 + * Compute the address of the hyp vectors after relocation. 427 + * This requires some arithmetic since we cannot directly 428 + * reference __hyp_stub_vectors in a PC-relative way. 429 + * Call __hyp_set_vectors with the new address so that we 430 + * can HVC again after the copy. 431 + */ 432 + 0: adr r0, 0b 433 + movw r1, #:lower16:__hyp_stub_vectors - 0b 434 + movt r1, #:upper16:__hyp_stub_vectors - 0b 435 + add r0, r0, r1 426 436 sub r0, r0, r5 427 437 add r0, r0, r10 428 438 bl __hyp_set_vectors