x86/speculation: Fix redundant MDS mitigation message
[linux-2.6-block.git] / arch / s390 / include / asm / ctl_reg.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright IBM Corp. 1999, 2009
4  *
5  * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
6  */
7
8 #ifndef __ASM_CTL_REG_H
9 #define __ASM_CTL_REG_H
10
11 #include <linux/bits.h>
12
13 #define CR0_CLOCK_COMPARATOR_SIGN       BIT(63 - 10)
14 #define CR0_EMERGENCY_SIGNAL_SUBMASK    BIT(63 - 49)
15 #define CR0_EXTERNAL_CALL_SUBMASK       BIT(63 - 50)
16 #define CR0_CLOCK_COMPARATOR_SUBMASK    BIT(63 - 52)
17 #define CR0_CPU_TIMER_SUBMASK           BIT(63 - 53)
18 #define CR0_SERVICE_SIGNAL_SUBMASK      BIT(63 - 54)
19 #define CR0_UNUSED_56                   BIT(63 - 56)
20 #define CR0_INTERRUPT_KEY_SUBMASK       BIT(63 - 57)
21 #define CR0_MEASUREMENT_ALERT_SUBMASK   BIT(63 - 58)
22
23 #define CR2_GUARDED_STORAGE             BIT(63 - 59)
24
25 #define CR14_UNUSED_32                  BIT(63 - 32)
26 #define CR14_UNUSED_33                  BIT(63 - 33)
27 #define CR14_CHANNEL_REPORT_SUBMASK     BIT(63 - 35)
28 #define CR14_RECOVERY_SUBMASK           BIT(63 - 36)
29 #define CR14_DEGRADATION_SUBMASK        BIT(63 - 37)
30 #define CR14_EXTERNAL_DAMAGE_SUBMASK    BIT(63 - 38)
31 #define CR14_WARNING_SUBMASK            BIT(63 - 39)
32
33 #ifndef __ASSEMBLY__
34
35 #include <linux/bug.h>
36
37 #define __ctl_load(array, low, high) do {                               \
38         typedef struct { char _[sizeof(array)]; } addrtype;             \
39                                                                         \
40         BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
41         asm volatile(                                                   \
42                 "       lctlg   %1,%2,%0\n"                             \
43                 :                                                       \
44                 : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high)    \
45                 : "memory");                                            \
46 } while (0)
47
48 #define __ctl_store(array, low, high) do {                              \
49         typedef struct { char _[sizeof(array)]; } addrtype;             \
50                                                                         \
51         BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
52         asm volatile(                                                   \
53                 "       stctg   %1,%2,%0\n"                             \
54                 : "=Q" (*(addrtype *)(&array))                          \
55                 : "i" (low), "i" (high));                               \
56 } while (0)
57
58 static __always_inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
59 {
60         unsigned long reg;
61
62         __ctl_store(reg, cr, cr);
63         reg |= 1UL << bit;
64         __ctl_load(reg, cr, cr);
65 }
66
67 static __always_inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
68 {
69         unsigned long reg;
70
71         __ctl_store(reg, cr, cr);
72         reg &= ~(1UL << bit);
73         __ctl_load(reg, cr, cr);
74 }
75
76 void smp_ctl_set_bit(int cr, int bit);
77 void smp_ctl_clear_bit(int cr, int bit);
78
79 union ctlreg0 {
80         unsigned long val;
81         struct {
82                 unsigned long      : 8;
83                 unsigned long tcx  : 1; /* Transactional-Execution control */
84                 unsigned long pifo : 1; /* Transactional-Execution Program-
85                                            Interruption-Filtering Override */
86                 unsigned long      : 22;
87                 unsigned long      : 3;
88                 unsigned long lap  : 1; /* Low-address-protection control */
89                 unsigned long      : 4;
90                 unsigned long edat : 1; /* Enhanced-DAT-enablement control */
91                 unsigned long      : 2;
92                 unsigned long iep  : 1; /* Instruction-Execution-Protection */
93                 unsigned long      : 1;
94                 unsigned long afp  : 1; /* AFP-register control */
95                 unsigned long vx   : 1; /* Vector enablement control */
96                 unsigned long      : 7;
97                 unsigned long sssm : 1; /* Service signal subclass mask */
98                 unsigned long      : 9;
99         };
100 };
101
102 union ctlreg2 {
103         unsigned long val;
104         struct {
105                 unsigned long       : 33;
106                 unsigned long ducto : 25;
107                 unsigned long       : 1;
108                 unsigned long gse   : 1;
109                 unsigned long       : 1;
110                 unsigned long tds   : 1;
111                 unsigned long tdc   : 2;
112         };
113 };
114
115 #define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
116 #define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
117
118 #endif /* __ASSEMBLY__ */
119 #endif /* __ASM_CTL_REG_H */