x86/oprofile: Fix bogus GCC-8 warning in nmi_setup()
[cris-mirror.git] / arch / s390 / include / asm / ctl_reg.h
blob99c93d0346f9feda966ec81f3a881035712d5528
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/const.h>
13 #define CR2_GUARDED_STORAGE _BITUL(63 - 59)
15 #define CR14_CHANNEL_REPORT_SUBMASK _BITUL(63 - 35)
16 #define CR14_RECOVERY_SUBMASK _BITUL(63 - 36)
17 #define CR14_DEGRADATION_SUBMASK _BITUL(63 - 37)
18 #define CR14_EXTERNAL_DAMAGE_SUBMASK _BITUL(63 - 38)
19 #define CR14_WARNING_SUBMASK _BITUL(63 - 39)
21 #ifndef __ASSEMBLY__
23 #include <linux/bug.h>
25 #define __ctl_load(array, low, high) do { \
26 typedef struct { char _[sizeof(array)]; } addrtype; \
28 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
29 asm volatile( \
30 " lctlg %1,%2,%0\n" \
31 : \
32 : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high) \
33 : "memory"); \
34 } while (0)
36 #define __ctl_store(array, low, high) do { \
37 typedef struct { char _[sizeof(array)]; } addrtype; \
39 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
40 asm volatile( \
41 " stctg %1,%2,%0\n" \
42 : "=Q" (*(addrtype *)(&array)) \
43 : "i" (low), "i" (high)); \
44 } while (0)
46 static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
48 unsigned long reg;
50 __ctl_store(reg, cr, cr);
51 reg |= 1UL << bit;
52 __ctl_load(reg, cr, cr);
55 static inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
57 unsigned long reg;
59 __ctl_store(reg, cr, cr);
60 reg &= ~(1UL << bit);
61 __ctl_load(reg, cr, cr);
64 void smp_ctl_set_bit(int cr, int bit);
65 void smp_ctl_clear_bit(int cr, int bit);
67 union ctlreg0 {
68 unsigned long val;
69 struct {
70 unsigned long : 8;
71 unsigned long tcx : 1; /* Transactional-Execution control */
72 unsigned long pifo : 1; /* Transactional-Execution Program-
73 Interruption-Filtering Override */
74 unsigned long : 22;
75 unsigned long : 3;
76 unsigned long lap : 1; /* Low-address-protection control */
77 unsigned long : 4;
78 unsigned long edat : 1; /* Enhanced-DAT-enablement control */
79 unsigned long : 2;
80 unsigned long iep : 1; /* Instruction-Execution-Protection */
81 unsigned long : 1;
82 unsigned long afp : 1; /* AFP-register control */
83 unsigned long vx : 1; /* Vector enablement control */
84 unsigned long : 7;
85 unsigned long sssm : 1; /* Service signal subclass mask */
86 unsigned long : 9;
90 union ctlreg2 {
91 unsigned long val;
92 struct {
93 unsigned long : 33;
94 unsigned long ducto : 25;
95 unsigned long : 1;
96 unsigned long gse : 1;
97 unsigned long : 1;
98 unsigned long tds : 1;
99 unsigned long tdc : 2;
103 #ifdef CONFIG_SMP
104 # define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
105 # define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
106 #else
107 # define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
108 # define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
109 #endif
111 #endif /* __ASSEMBLY__ */
112 #endif /* __ASM_CTL_REG_H */