Skip to content

Commit 2c2ca34

Browse files
mrutland-armzx2c4
authored andcommitted
arm64: alternative: make alternative_has_cap_likely() VDSO compatible
Currently alternative_has_cap_unlikely() can be used in VDSO code, but alternative_has_cap_likely() cannot as it references alt_cb_patch_nops, which is not available when linking the VDSO. This is unfortunate as it would be useful to have alternative_has_cap_likely() available in VDSO code. The use of alt_cb_patch_nops was added in commit: d926079 ("arm64: alternatives: add shared NOP callback") ... as removing duplicate NOPs within the kernel Image saved areasonable amount of space. Given the VDSO code will have nowhere near as many alternative branches as the main kernel image, this isn't much of a concern, and a few extra nops isn't a massive problem. Change alternative_has_cap_likely() to only use alt_cb_patch_nops for the main kernel image, and allow duplicate NOPs in VDSO code. Signed-off-by: Mark Rutland <[email protected]> Signed-off-by: Adhemerval Zanella <[email protected]> Acked-by: Will Deacon <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent bb10ffe commit 2c2ca34

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/include/asm/alternative-macros.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ alternative_has_cap_likely(const unsigned long cpucap)
230230
return false;
231231

232232
asm goto(
233+
#ifdef BUILD_VDSO
234+
ALTERNATIVE("b %l[l_no]", "nop", %[cpucap])
235+
#else
233236
ALTERNATIVE_CB("b %l[l_no]", %[cpucap], alt_cb_patch_nops)
237+
#endif
234238
:
235239
: [cpucap] "i" (cpucap)
236240
:

0 commit comments

Comments
 (0)