Skip to content

Commit fad442d

Browse files
committed
s390/alternatives: provide identical sized orginal/alternative sequences
Explicitly provide identical sized original/alternative instruction sequences. This way there is no need for the s390 specific alternatives infrastructure to generate padding sequences. The code which generates such sequences will be removed with a follow on patch. Acked-by: Vasily Gorbik <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Tested-by: Nick Desaulniers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent c9311de commit fad442d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

arch/s390/include/asm/spinlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lp)
7979
typecheck(int, lp->lock);
8080
kcsan_release();
8181
asm_inline volatile(
82-
ALTERNATIVE("", ".insn rre,0xb2fa0000,7,0", 49) /* NIAI 7 */
82+
ALTERNATIVE("nop", ".insn rre,0xb2fa0000,7,0", 49) /* NIAI 7 */
8383
" sth %1,%0\n"
8484
: "=R" (((unsigned short *) &lp->lock)[1])
8585
: "d" (0) : "cc", "memory");

arch/s390/kernel/entry.S

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
5353
_LPP_OFFSET = __LC_LPP
5454

5555
.macro STBEAR address
56-
ALTERNATIVE "", ".insn s,0xb2010000,\address", 193
56+
ALTERNATIVE "nop", ".insn s,0xb2010000,\address", 193
5757
.endm
5858

5959
.macro LBEAR address
60-
ALTERNATIVE "", ".insn s,0xb2000000,\address", 193
60+
ALTERNATIVE "nop", ".insn s,0xb2000000,\address", 193
6161
.endm
6262

6363
.macro LPSWEY address,lpswe
64-
ALTERNATIVE "b \lpswe", ".insn siy,0xeb0000000071,\address,0", 193
64+
ALTERNATIVE "b \lpswe; nopr", ".insn siy,0xeb0000000071,\address,0", 193
6565
.endm
6666

6767
.macro MBEAR reg
68-
ALTERNATIVE "", __stringify(mvc __PT_LAST_BREAK(8,\reg),__LC_LAST_BREAK), 193
68+
ALTERNATIVE "brcl 0,0", __stringify(mvc __PT_LAST_BREAK(8,\reg),__LC_LAST_BREAK), 193
6969
.endm
7070

7171
.macro CHECK_STACK savearea
@@ -121,16 +121,16 @@ _LPP_OFFSET = __LC_LPP
121121
.endm
122122

123123
.macro BPOFF
124-
ALTERNATIVE "", ".insn rrf,0xb2e80000,0,0,12,0", 82
124+
ALTERNATIVE "nop", ".insn rrf,0xb2e80000,0,0,12,0", 82
125125
.endm
126126

127127
.macro BPON
128-
ALTERNATIVE "", ".insn rrf,0xb2e80000,0,0,13,0", 82
128+
ALTERNATIVE "nop", ".insn rrf,0xb2e80000,0,0,13,0", 82
129129
.endm
130130

131131
.macro BPENTER tif_ptr,tif_mask
132132
ALTERNATIVE "TSTMSK \tif_ptr,\tif_mask; jz .+8; .insn rrf,0xb2e80000,0,0,13,0", \
133-
"", 82
133+
"j .+12; nop; nop", 82
134134
.endm
135135

136136
.macro BPEXIT tif_ptr,tif_mask
@@ -226,7 +226,7 @@ ENTRY(__switch_to)
226226
aghi %r3,__TASK_pid
227227
mvc __LC_CURRENT_PID(4,%r0),0(%r3) # store pid of next
228228
lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
229-
ALTERNATIVE "", "lpp _LPP_OFFSET", 40
229+
ALTERNATIVE "nop", "lpp _LPP_OFFSET", 40
230230
BR_EX %r14
231231
ENDPROC(__switch_to)
232232

@@ -610,7 +610,7 @@ ENTRY(mcck_int_handler)
610610
jno 0f
611611
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
612612
stpt __LC_EXIT_TIMER
613-
0: ALTERNATIVE "", __stringify(lghi %r12,__LC_LAST_BREAK_SAVE_AREA),193
613+
0: ALTERNATIVE "nop", __stringify(lghi %r12,__LC_LAST_BREAK_SAVE_AREA),193
614614
LBEAR 0(%r12)
615615
lmg %r11,%r15,__PT_R11(%r11)
616616
LPSWEY __LC_RETURN_MCCK_PSW,__LC_RETURN_MCCK_LPSWE
@@ -646,7 +646,7 @@ ENTRY(mcck_int_handler)
646646
ENDPROC(mcck_int_handler)
647647

648648
ENTRY(restart_int_handler)
649-
ALTERNATIVE "", "lpp _LPP_OFFSET", 40
649+
ALTERNATIVE "nop", "lpp _LPP_OFFSET", 40
650650
stg %r15,__LC_SAVE_AREA_RESTART
651651
TSTMSK __LC_RESTART_FLAGS,RESTART_FLAG_CTLREGS,4
652652
jz 0f

arch/s390/lib/spinlock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static inline int arch_load_niai4(int *lock)
7575
int owner;
7676

7777
asm_inline volatile(
78-
ALTERNATIVE("", ".insn rre,0xb2fa0000,4,0", 49) /* NIAI 4 */
78+
ALTERNATIVE("nop", ".insn rre,0xb2fa0000,4,0", 49) /* NIAI 4 */
7979
" l %0,%1\n"
8080
: "=d" (owner) : "Q" (*lock) : "memory");
8181
return owner;
@@ -86,7 +86,7 @@ static inline int arch_cmpxchg_niai8(int *lock, int old, int new)
8686
int expected = old;
8787

8888
asm_inline volatile(
89-
ALTERNATIVE("", ".insn rre,0xb2fa0000,8,0", 49) /* NIAI 8 */
89+
ALTERNATIVE("nop", ".insn rre,0xb2fa0000,8,0", 49) /* NIAI 8 */
9090
" cs %0,%3,%1\n"
9191
: "=d" (old), "=Q" (*lock)
9292
: "0" (old), "d" (new), "Q" (*lock)

0 commit comments

Comments
 (0)