]> git.ipfire.org Git - thirdparty/linux.git/commit
s390: Static branches for machine features infrastructure
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 7 Feb 2025 14:48:56 +0000 (15:48 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 4 Mar 2025 16:18:05 +0000 (17:18 +0100)
commitb7e81efc2436c553ca29eae5f069480de3d9f975
tree26b31206db6b9854df1c06a76d75f055d0d517d4
parent949b73c9902613bddb789d9375981afbffe596fc
s390: Static branches for machine features infrastructure

Provide infrastructure which allows to generate machine_has_<feature>()
functions, which are replacing the existing MACHINE_HAS_<feature> macros.
Such function usages generate a static branch depending on <feature>. The
static branch is patched using an alternative.

Each <feature> correlates with a bit set in the machine_features bit
field. If the corresponding bit is set, the branch will be patched. In
order to have any effect on branch patching feature bits must be set with
set_machine_features() in the decompressor before alternatives patching of
the kernel image.

It is possible to use clear_machine_feature() and test_machine_feature()
for machine features which cannot be completely detected within the
decompressor, e.g. if common code command line parameters allow to enable
or disable certain features. In such cases test_machine_feature() instead
of machine_has_feature() must be used within the kernel. This results in a
runtime check and not a static branch.

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/alternative.h
arch/s390/include/asm/machine.h [new file with mode: 0644]
arch/s390/kernel/alternative.c