History log of /linux-master/arch/s390/include/asm/alternative.h
Revision Date Author Comments
# e6ed91fd 11-May-2022 Heiko Carstens <hca@linux.ibm.com>

s390/alternatives: remove padding generation code

clang fails to handle ".if" statements in inline assembly which are heavily
used in the alternatives code.

To work around this remove this code, and enforce that users of
alternatives must specify original and alternative instruction sequences
which have identical sizes. Add a compile time check with two ".org"
statements similar to arm64.

In result not only clang can handle this, but also quite a lot of code can
be removed.

Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/1356
Link: https://lore.kernel.org/r/20220511120532.2228616-3-hca@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>


# faf79934 28-Mar-2022 Vasily Gorbik <gor@linux.ibm.com>

s390/alternatives: avoid using jgnop mnemonic

jgnop mnemonic is only available since binutils 2.36,
kernel minimal required version is 2.23. Stick to brcl
to avoid build errors.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Fixes: 4afeb670710e ("s390/alternatives: use instructions instead of byte patterns")
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>


# 4afeb670 13-Mar-2022 Heiko Carstens <hca@linux.ibm.com>

s390/alternatives: use instructions instead of byte patterns

Use readable nop instructions within the code which generates
the padding areas, instead of unreadable byte patterns.

The generated code is identical.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>


# 80841ad8 02-Feb-2021 Heiko Carstens <hca@linux.ibm.com>

s390/alternatives: add alternative_input() / alternative_io()

Add support for alternative inline assemblies with input and output
arguments. This is consistent to x86.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>


# cceb0183 18-Oct-2019 Heiko Carstens <hca@linux.ibm.com>

s390/alternatives: make use of asm_inline

This is the s390 version of commit 40576e5e63ea ("x86: alternative.h:
use asm_inline for all alternative variants").

See commit eb111869301e ("compiler-types.h: add asm_inline
definition") for more details.

With this change the compiler will not generate many out-of-line
versions for the three instruction sized arch_spin_unlock() function
anymore. Due to this gcc seems to change a lot of other inline
decisions which results in a net 6k text size growth according to
bloat-o-meter (gcc 9.2 with defconfig).
But that's still better than having many out-of-line versions of
arch_spin_unlock().

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>


# 9fa1db4c 04-Dec-2017 Martin Schwidefsky <schwidefsky@de.ibm.com>

s390: add a few more SPDX identifiers

Add the correct SPDX license to a few more files under arch/s390 and
drivers/s390 which have been missed to far.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>


# 049a2c2d 14-Nov-2017 Heiko Carstens <hca@linux.ibm.com>

s390: enable CPU alternatives unconditionally

Remove the CPU_ALTERNATIVES config option and enable the code
unconditionally. The config option was only added to avoid a conflict
with the named saved segment support. Since that code is gone there is
no reason to keep the CPU_ALTERNATIVES config option.

Just enable it unconditionally to also reduce the number of config
options and make it less likely that something breaks.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>


# 686140a1 12-Oct-2017 Vasily Gorbik <gor@linux.vnet.ibm.com>

s390: introduce CPU alternatives

Implement CPU alternatives, which allows to optionally patch newer
instructions at runtime, based on CPU facilities availability.

A new kernel boot parameter "noaltinstr" disables patching.

Current implementation is derived from x86 alternatives. Although
ideal instructions padding (when altinstr is longer then oldinstr)
is added at compile time, and no oldinstr nops optimization has to be
done at runtime. Also couple of compile time sanity checks are done:
1. oldinstr and altinstr must be <= 254 bytes long,
2. oldinstr and altinstr must not have an odd length.

alternative(oldinstr, altinstr, facility);
alternative_2(oldinstr, altinstr1, facility1, altinstr2, facility2);

Both compile time and runtime padding consists of either 6/4/2 bytes nop
or a jump (brcl) + 2 bytes nop filler if padding is longer then 6 bytes.

.altinstructions and .altinstr_replacement sections are part of
__init_begin : __init_end region and are freed after initialization.

Signed-off-by: Vasily Gorbik <gor@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>