x86/speculation/mds: Fix documentation typo
[linux/fpc-iii.git] / arch / s390 / include / asm / ctl_reg.h
blob93e0d72f6c9484b900a328f0f2aef65aa1dc5749
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright IBM Corp. 1999, 2009
5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
6 */
8 #ifndef __ASM_CTL_REG_H
9 #define __ASM_CTL_REG_H
11 #include <linux/bug.h>
13 #define __ctl_load(array, low, high) do { \
14 typedef struct { char _[sizeof(array)]; } addrtype; \
16 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
17 asm volatile( \
18 " lctlg %1,%2,%0\n" \
19 : \
20 : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high) \
21 : "memory"); \
22 } while (0)
24 #define __ctl_store(array, low, high) do { \
25 typedef struct { char _[sizeof(array)]; } addrtype; \
27 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
28 asm volatile( \
29 " stctg %1,%2,%0\n" \
30 : "=Q" (*(addrtype *)(&array)) \
31 : "i" (low), "i" (high)); \
32 } while (0)
34 static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
36 unsigned long reg;
38 __ctl_store(reg, cr, cr);
39 reg |= 1UL << bit;
40 __ctl_load(reg, cr, cr);
43 static inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
45 unsigned long reg;
47 __ctl_store(reg, cr, cr);
48 reg &= ~(1UL << bit);
49 __ctl_load(reg, cr, cr);
52 void smp_ctl_set_bit(int cr, int bit);
53 void smp_ctl_clear_bit(int cr, int bit);
55 union ctlreg0 {
56 unsigned long val;
57 struct {
58 unsigned long : 32;
59 unsigned long : 3;
60 unsigned long lap : 1; /* Low-address-protection control */
61 unsigned long : 4;
62 unsigned long edat : 1; /* Enhanced-DAT-enablement control */
63 unsigned long : 2;
64 unsigned long iep : 1; /* Instruction-Execution-Protection */
65 unsigned long : 1;
66 unsigned long afp : 1; /* AFP-register control */
67 unsigned long vx : 1; /* Vector enablement control */
68 unsigned long : 7;
69 unsigned long sssm : 1; /* Service signal subclass mask */
70 unsigned long : 9;
74 #ifdef CONFIG_SMP
75 # define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
76 # define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
77 #else
78 # define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
79 # define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
80 #endif
82 #endif /* __ASM_CTL_REG_H */