diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2023-09-11 22:39:59 +0300 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2023-09-19 14:26:56 +0300 |
commit | dfa33ce1245a4b88402947fa0a847e179044d2fc (patch) | |
tree | f507200b7fa3bc727a294e490627c89da118785b /arch/s390/include/asm/ctlreg.h | |
parent | 8d5e98f8d6b11dd0e61323ece3b7ccceea55c281 (diff) | |
download | linux-dfa33ce1245a4b88402947fa0a847e179044d2fc.tar.xz |
s390/ctlreg: add local_ctl_load() and local_ctl_store()
Add local_ctl_load() and local_ctl_store() which load and store contents
for only a single control register.
This allows for easier to read code, but also better type checking,
since __local_ctl_load() and __local_ctl_store() do not come with any
type checking at all (which will be changed with subsequent patches).
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/ctlreg.h')
-rw-r--r-- | arch/s390/include/asm/ctlreg.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/s390/include/asm/ctlreg.h b/arch/s390/include/asm/ctlreg.h index 09d35ab3d1ce..e8e5aef08bfd 100644 --- a/arch/s390/include/asm/ctlreg.h +++ b/arch/s390/include/asm/ctlreg.h @@ -69,6 +69,23 @@ : [_low] "i" (low), [_high] "i" (high)); \ } while (0) +static __always_inline void local_ctl_load(unsigned int cr, unsigned long *reg) +{ + asm volatile( + " lctlg %[cr],%[cr],%[reg]\n" + : + : [reg] "Q" (*reg), [cr] "i" (cr) + : "memory"); +} + +static __always_inline void local_ctl_store(unsigned int cr, unsigned long *reg) +{ + asm volatile( + " stctg %[cr],%[cr],%[reg]\n" + : [reg] "=Q" (*reg) + : [cr] "i" (cr)); +} + static __always_inline void local_ctl_set_bit(unsigned int cr, unsigned int bit) { unsigned long reg; |