Commit 207ddb91 authored by Heiko Carstens's avatar Heiko Carstens Committed by Alexander Gordeev

s390/alternatives: Convert runtime sanity check into compile time check

__apply_alternatives() contains a runtime check which verifies that the
size of the to be patched code area is even. Convert this to a compile time
check using a similar ".org" trick, which is already used to verify that
old and new code areas have the same size.
Reviewed-by: default avatarSven Schnelle <svens@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent effb8357
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
.long \alt_start - . .long \alt_start - .
.word \feature .word \feature
.byte \orig_end - \orig_start .byte \orig_end - \orig_start
.org . - ( \orig_end - \orig_start ) & 1
.org . - ( \orig_end - \orig_start ) + ( \alt_end - \alt_start ) .org . - ( \orig_end - \orig_start ) + ( \alt_end - \alt_start )
.org . - ( \alt_end - \alt_start ) + ( \orig_end - \orig_start ) .org . - ( \alt_end - \alt_start ) + ( \orig_end - \orig_start )
.endm .endm
......
...@@ -53,6 +53,7 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end); ...@@ -53,6 +53,7 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
"\t.long " b_altinstr(num)"b - .\n" /* alt instruction */ \ "\t.long " b_altinstr(num)"b - .\n" /* alt instruction */ \
"\t.word " __stringify(facility) "\n" /* facility bit */ \ "\t.word " __stringify(facility) "\n" /* facility bit */ \
"\t.byte " oldinstr_len "\n" /* instruction len */ \ "\t.byte " oldinstr_len "\n" /* instruction len */ \
"\t.org . - (" oldinstr_len ") & 1\n" \
"\t.org . - (" oldinstr_len ") + (" altinstr_len(num) ")\n" \ "\t.org . - (" oldinstr_len ") + (" altinstr_len(num) ")\n" \
"\t.org . - (" altinstr_len(num) ") + (" oldinstr_len ")\n" "\t.org . - (" altinstr_len(num) ") + (" oldinstr_len ")\n"
......
...@@ -33,13 +33,6 @@ static void __init_or_module __apply_alternatives(struct alt_instr *start, ...@@ -33,13 +33,6 @@ static void __init_or_module __apply_alternatives(struct alt_instr *start,
if (!__test_facility(a->facility, alt_stfle_fac_list)) if (!__test_facility(a->facility, alt_stfle_fac_list))
continue; continue;
if (unlikely(a->instrlen % 2)) {
WARN_ONCE(1, "cpu alternatives instructions length is "
"odd, skipping patching\n");
continue;
}
s390_kernel_write(instr, replacement, a->instrlen); s390_kernel_write(instr, replacement, a->instrlen);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment