]> www.infradead.org Git - users/jedix/linux-maple.git/commit
s390/facility: Let test_facility() generate static branch if possible
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 13 Sep 2024 13:05:39 +0000 (15:05 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 13 Sep 2024 15:28:36 +0000 (17:28 +0200)
commit94c7755b1e8f9a8953c25f0900650be009e7be7a
treeb1c8d60bb76cc94e9e17dc605ad1d01188356e7e
parent013e984397a27129972cb1d89589d2b5be95a40e
s390/facility: Let test_facility() generate static branch if possible

Let test_facility() generate a branch instruction if the tested facility is
a constant, and where the result cannot be evaluated during compile
time. The branch instruction defaults to "false" and is patched to nop
(branch not taken) if the tested facility is available.

This avoids runtime checks and is similar to x86's static_cpu_has() and
arm64's alternative_has_cap_likely().

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
arch/s390/include/asm/facility.h