diff options
| author | Heiko Carstens <hca@linux.ibm.com> | 2025-01-13 13:37:04 +0100 |
|---|---|---|
| committer | Alexander Gordeev <agordeev@linux.ibm.com> | 2025-01-26 17:24:06 +0100 |
| commit | dc7ff4b8cb782901c0c6809c708502293165a780 (patch) | |
| tree | 92b722da93c2f0f1dc745688493397d5feef3d34 /arch/s390/include | |
| parent | 67e959af254fe842c7b2ba4396c931985b289ef9 (diff) | |
s390/uaccess: Replace EX_TABLE_UA_LOAD_MEM exception handling
Remove EX_TABLE_UA_LOAD_MEM exception handling and replace it with
EX_TABLE_UA_FAULT. Open code the return code check, and also open code
setting of the destination to zero in case of an error. In almost all cases
the compiler is able to optimize the open coded checks away, since all
users of get_users() must check the return code, and are not supposed to
use the result in case of an error.
In addition this allows to change the get_user() inline assembly so that
the "Q" constraint can be used for the destination, instead of only an "a"
constraint. This generates slightly better code.
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Diffstat (limited to 'arch/s390/include')
| -rw-r--r-- | arch/s390/include/asm/asm-extable.h | 4 | ||||
| -rw-r--r-- | arch/s390/include/asm/uaccess.h | 14 |
2 files changed, 8 insertions, 10 deletions
diff --git a/arch/s390/include/asm/asm-extable.h b/arch/s390/include/asm/asm-extable.h index 5f47569c908a..2e829c16fd8a 100644 --- a/arch/s390/include/asm/asm-extable.h +++ b/arch/s390/include/asm/asm-extable.h @@ -10,7 +10,6 @@ #define EX_TYPE_FIXUP 1 #define EX_TYPE_BPF 2 #define EX_TYPE_UA_FAULT 3 -#define EX_TYPE_UA_LOAD_MEM 4 #define EX_TYPE_UA_LOAD_REG 5 #define EX_TYPE_UA_LOAD_REGPAIR 6 #define EX_TYPE_ZEROPAD 7 @@ -73,9 +72,6 @@ #define EX_TABLE_UA_FAULT(_fault, _target, _regerr) \ __EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_FAULT, _regerr, _regerr, 0) -#define EX_TABLE_UA_LOAD_MEM(_fault, _target, _regerr, _regmem, _len) \ - __EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_MEM, _regerr, _regmem, _len) - #define EX_TABLE_UA_LOAD_REG(_fault, _target, _regerr, _regzero) \ __EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_REG, _regerr, _regzero, 0) diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h index 8f6170852410..db22aefd452c 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h @@ -184,16 +184,18 @@ __get_user_##type##_noinstr(unsigned type *to, \ \ asm volatile( \ " lr %%r0,%[spec]\n" \ - "0: mvcos 0(%[to]),%[from],%[size]\n" \ + "0: mvcos %[to],%[from],%[size]\n" \ "1: lhi %[rc],0\n" \ "2:\n" \ - EX_TABLE_UA_LOAD_MEM(0b, 2b, %[rc], %[to], %[ksize]) \ - EX_TABLE_UA_LOAD_MEM(1b, 2b, %[rc], %[to], %[ksize]) \ - : [rc] "=d" (rc), "=Q" (*to) \ + EX_TABLE_UA_FAULT(0b, 2b, %[rc]) \ + EX_TABLE_UA_FAULT(1b, 2b, %[rc]) \ + : [rc] "=d" (rc), [to] "=Q" (*to) \ : [size] "d" (size), [from] "Q" (*from), \ - [spec] "d" (__oac_spec.val), [to] "a" (to), \ - [ksize] "K" (size) \ + [spec] "d" (__oac_spec.val) \ : "cc", "0"); \ + if (likely(!rc)) \ + return 0; \ + *to = 0; \ return rc; \ } \ \ |
