[PATCH 11/32] s390/uaccess: Convert inline assembly to EX_TABLE_INSN

From: Heiko Carstens

Date: Thu Oct 01 2026 - 06:48:54 EST


Convert all uaccess exception table entries to use EX_TABLE_INSN.
With EX_TABLE_INSN entries always point to the faulting instruction,
so duplicate entries and nopr padding are no longer needed and removed.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/include/asm/uaccess.h | 45 +++++++++++----------------------
1 file changed, 15 insertions(+), 30 deletions(-)

diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index a9f32c53f699..ac99b32c6ceb 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -43,10 +43,8 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long size)
asm_inline volatile(
" lhi %%r0,%[spec]\n"
"0: mvcos %[to],%[from],%[size]\n"
- "1: nopr %%r7\n"
CC_IPM(cc)
- EX_TABLE_UA_MVCOS_FROM(0b, 0b)
- EX_TABLE_UA_MVCOS_FROM(1b, 0b)
+ EX_TABLE_INSN_UA_MVCOS_FROM(0b, 0b)
: CC_OUT(cc, cc), [size] "+d" (size), [to] "=Q" (*(char *)to)
: [spec] "I" (0x81), [from] "Q" (*(const char __user *)from)
: CC_CLOBBER_LIST("memory", "0"));
@@ -71,10 +69,8 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long size)
asm_inline volatile(
" llilh %%r0,%[spec]\n"
"0: mvcos %[to],%[from],%[size]\n"
- "1: nopr %%r7\n"
CC_IPM(cc)
- EX_TABLE_UA_MVCOS_TO(0b, 0b)
- EX_TABLE_UA_MVCOS_TO(1b, 0b)
+ EX_TABLE_INSN_UA_MVCOS_TO(0b, 0b)
: CC_OUT(cc, cc), [size] "+d" (size), [to] "=Q" (*(char __user *)to)
: [spec] "I" (0x81), [from] "Q" (*(const char *)from)
: CC_CLOBBER_LIST("memory", "0"));
@@ -123,9 +119,7 @@ __put_user_##type##_noinstr(unsigned type __user *to, \
asm goto( \
" llilh %%r0,%[spec]\n" \
"0: mvcos %[to],%[from],%[size]\n" \
- "1: nopr %%r7\n" \
- EX_TABLE(0b, %l[Efault]) \
- EX_TABLE(1b, %l[Efault]) \
+ EX_TABLE_INSN(0b, %l[Efault]) \
: [to] "+Q" (*to) \
: [size] "d" (size), [from] "Q" (*from), \
[spec] "I" (0x81) \
@@ -150,10 +144,9 @@ __put_user_##type##_noinstr(unsigned type __user *to, \
asm_inline volatile( \
" llilh %%r0,%[spec]\n" \
"0: mvcos %[to],%[from],%[size]\n" \
- "1: lhi %[rc],0\n" \
- "2:\n" \
- EX_TABLE_UA_FAULT(0b, 2b, %[rc]) \
- EX_TABLE_UA_FAULT(1b, 2b, %[rc]) \
+ " lhi %[rc],0\n" \
+ "1:\n" \
+ EX_TABLE_INSN_UA_FAULT(0b, 1b, %[rc]) \
: [rc] "=d" (rc), [to] "+Q" (*to) \
: [size] "d" (size), [from] "Q" (*from), \
[spec] "I" (0x81) \
@@ -238,9 +231,7 @@ __get_user_##type##_noinstr(unsigned type *to, \
asm goto( \
" lhi %%r0,%[spec]\n" \
"0: mvcos %[to],%[from],%[size]\n" \
- "1: nopr %%r7\n" \
- EX_TABLE(0b, %l[Efault]) \
- EX_TABLE(1b, %l[Efault]) \
+ EX_TABLE_INSN(0b, %l[Efault]) \
: [to] "=Q" (*to) \
: [size] "d" (size), [from] "Q" (*from), \
[spec] "I" (0x81) \
@@ -266,10 +257,9 @@ __get_user_##type##_noinstr(unsigned type *to, \
asm_inline volatile( \
" lhi %%r0,%[spec]\n" \
"0: mvcos %[to],%[from],%[size]\n" \
- "1: lhi %[rc],0\n" \
- "2:\n" \
- EX_TABLE_UA_FAULT(0b, 2b, %[rc]) \
- EX_TABLE_UA_FAULT(1b, 2b, %[rc]) \
+ " lhi %[rc],0\n" \
+ "1:\n" \
+ EX_TABLE_INSN_UA_FAULT(0b, 1b, %[rc]) \
: [rc] "=d" (rc), [to] "=Q" (*to) \
: [size] "d" (size), [from] "Q" (*from), \
[spec] "I" (0x81) \
@@ -374,10 +364,8 @@ __clear_user(void __user *to, unsigned long size)
asm_inline volatile(
" llilh %%r0,%[spec]\n"
"0: mvcos %[to],%[from],%[size]\n"
- "1: nopr %%r7\n"
CC_IPM(cc)
- EX_TABLE_UA_MVCOS_TO(0b, 0b)
- EX_TABLE_UA_MVCOS_TO(1b, 0b)
+ EX_TABLE_INSN_UA_MVCOS_TO(0b, 0b)
: CC_OUT(cc, cc), [size] "+d" (size), [to] "=Q" (*(char __user *)to)
: [spec] "I" (0x81), [from] "Q" (*(const char *)empty_zero_page)
: CC_CLOBBER_LIST("memory", "0"));
@@ -418,9 +406,7 @@ do { \
case 8: \
asm goto( \
"0: mvc %O[_dst](%[_len],%R[_dst]),%[_src]\n" \
- "1: nopr %%r7\n" \
- EX_TABLE(0b, %l[err_label]) \
- EX_TABLE(1b, %l[err_label]) \
+ EX_TABLE_INSN(0b, %l[err_label]) \
: [_dst] "=Q" (*(type *)dst) \
: [_src] "Q" (*(type *)(src)), \
[_len] "I" (sizeof(type)) \
@@ -447,10 +433,9 @@ do { \
case 8: \
asm_inline volatile( \
"0: mvc 0(%[_len],%[_dst]),%[_src]\n" \
- "1: lhi %[_rc],0\n" \
- "2:\n" \
- EX_TABLE_UA_FAULT(0b, 2b, %[_rc]) \
- EX_TABLE_UA_FAULT(1b, 2b, %[_rc]) \
+ " lhi %[_rc],0\n" \
+ "1:\n" \
+ EX_TABLE_INSN_UA_FAULT(0b, 1b, %[_rc]) \
: [_rc] "=d" (__rc), \
"=m" (*__dst) \
: [_src] "Q" (*(type *)(src)), \
--
2.53.0