hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/s390/include/asm/cpu_mf.h
....@@ -12,6 +12,8 @@
1212 #include <linux/errno.h>
1313 #include <asm/facility.h>
1414
15
+asm(".include \"asm/cpu_mf-insn.h\"\n");
16
+
1517 #define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */
1618 #define CPU_MF_INT_SF_ISE (1 << 30) /* incorrect SDBT entry */
1719 #define CPU_MF_INT_SF_PRA (1 << 29) /* program request alert */
....@@ -25,6 +27,8 @@
2527 #define CPU_MF_INT_SF_MASK (CPU_MF_INT_SF_IAE|CPU_MF_INT_SF_ISE| \
2628 CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \
2729 CPU_MF_INT_SF_LSDA)
30
+
31
+#define CPU_MF_SF_RIBM_NOTAV 0x1 /* Sampling unavailable */
2832
2933 /* CPU measurement facility support */
3034 static inline int cpum_cf_avail(void)
....@@ -67,8 +71,9 @@
6771 unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/
6872 unsigned long tear; /* 24-31: TEAR contents */
6973 unsigned long dear; /* 32-39: DEAR contents */
70
- unsigned int rsvrd0; /* 40-43: reserved */
71
- unsigned int cpu_speed; /* 44-47: CPU speed */
74
+ unsigned int rsvrd0:24; /* 40-42: reserved */
75
+ unsigned int ribm:8; /* 43: Reserved by IBM */
76
+ unsigned int cpu_speed; /* 44-47: CPU speed */
7277 unsigned long long rsvrd1; /* 48-55: reserved */
7378 unsigned long long rsvrd2; /* 56-63: reserved */
7479 } __packed;
....@@ -87,10 +92,10 @@
8792 unsigned long tear; /* 16-23: TEAR contents */
8893 unsigned long dear; /* 24-31: DEAR contents */
8994 /* 32-63: */
90
- unsigned long rsvrd1; /* reserved */
91
- unsigned long rsvrd2; /* reserved */
92
- unsigned long rsvrd3; /* reserved */
93
- unsigned long rsvrd4; /* reserved */
95
+ unsigned long rsvrd1; /* reserved */
96
+ unsigned long rsvrd2; /* reserved */
97
+ unsigned long rsvrd3; /* reserved */
98
+ unsigned long rsvrd4; /* reserved */
9499 } __packed;
95100
96101 struct hws_basic_entry {
....@@ -123,19 +128,21 @@
123128 struct hws_diag_entry diag; /* Diagnostic-sampling data entry */
124129 } __packed;
125130
126
-struct hws_trailer_entry {
127
- union {
128
- struct {
129
- unsigned int f:1; /* 0 - Block Full Indicator */
130
- unsigned int a:1; /* 1 - Alert request control */
131
- unsigned int t:1; /* 2 - Timestamp format */
132
- unsigned int :29; /* 3 - 31: Reserved */
133
- unsigned int bsdes:16; /* 32-47: size of basic SDE */
134
- unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */
135
- };
136
- unsigned long long flags; /* 0 - 63: All indicators */
131
+union hws_trailer_header {
132
+ struct {
133
+ unsigned int f:1; /* 0 - Block Full Indicator */
134
+ unsigned int a:1; /* 1 - Alert request control */
135
+ unsigned int t:1; /* 2 - Timestamp format */
136
+ unsigned int :29; /* 3 - 31: Reserved */
137
+ unsigned int bsdes:16; /* 32-47: size of basic SDE */
138
+ unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */
139
+ unsigned long long overflow; /* 64 - Overflow Count */
137140 };
138
- unsigned long long overflow; /* 64 - sample Overflow count */
141
+ __uint128_t val;
142
+};
143
+
144
+struct hws_trailer_entry {
145
+ union hws_trailer_header header; /* 0 - 15 Flags + Overflow Count */
139146 unsigned char timestamp[16]; /* 16 - 31 timestamp */
140147 unsigned long long reserved1; /* 32 -Reserved */
141148 unsigned long long reserved2; /* */
....@@ -209,17 +216,26 @@
209216 return cc;
210217 }
211218
212
-/* Store CPU counter multiple for the MT utilization counter set */
213
-static inline int stcctm5(u64 num, u64 *val)
219
+/* Store CPU counter multiple for a particular counter set */
220
+enum stcctm_ctr_set {
221
+ EXTENDED = 0,
222
+ BASIC = 1,
223
+ PROBLEM_STATE = 2,
224
+ CRYPTO_ACTIVITY = 3,
225
+ MT_DIAG = 5,
226
+ MT_DIAG_CLEARING = 9, /* clears loss-of-MT-ctr-data alert */
227
+};
228
+
229
+static __always_inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest)
214230 {
215231 int cc;
216232
217233 asm volatile (
218
- " .insn rsy,0xeb0000000017,%2,5,%1\n"
234
+ " STCCTM %2,%3,%1\n"
219235 " ipm %0\n"
220236 " srl %0,28\n"
221237 : "=d" (cc)
222
- : "Q" (*val), "d" (num)
238
+ : "Q" (*dest), "d" (range), "i" (set)
223239 : "cc", "memory");
224240 return cc;
225241 }
....@@ -273,14 +289,11 @@
273289 return USEC_PER_SEC * qsi->cpu_speed / rate;
274290 }
275291
276
-#define SDB_TE_ALERT_REQ_MASK 0x4000000000000000UL
277
-#define SDB_TE_BUFFER_FULL_MASK 0x8000000000000000UL
278
-
279292 /* Return TOD timestamp contained in an trailer entry */
280293 static inline unsigned long long trailer_timestamp(struct hws_trailer_entry *te)
281294 {
282295 /* TOD in STCKE format */
283
- if (te->t)
296
+ if (te->header.t)
284297 return *((unsigned long long *) &te->timestamp[1]);
285298
286299 /* TOD in STCK format */
....@@ -299,7 +312,7 @@
299312 return (unsigned long *) ret;
300313 }
301314
302
-/* Return if the entry in the sample data block table (sdbt)
315
+/* Return true if the entry in the sample data block table (sdbt)
303316 * is a link to the next sdbt */
304317 static inline int is_link_entry(unsigned long *s)
305318 {