forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
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 {
....@@ -209,17 +214,26 @@
209214 return cc;
210215 }
211216
212
-/* Store CPU counter multiple for the MT utilization counter set */
213
-static inline int stcctm5(u64 num, u64 *val)
217
+/* Store CPU counter multiple for a particular counter set */
218
+enum stcctm_ctr_set {
219
+ EXTENDED = 0,
220
+ BASIC = 1,
221
+ PROBLEM_STATE = 2,
222
+ CRYPTO_ACTIVITY = 3,
223
+ MT_DIAG = 5,
224
+ MT_DIAG_CLEARING = 9, /* clears loss-of-MT-ctr-data alert */
225
+};
226
+
227
+static __always_inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest)
214228 {
215229 int cc;
216230
217231 asm volatile (
218
- " .insn rsy,0xeb0000000017,%2,5,%1\n"
232
+ " STCCTM %2,%3,%1\n"
219233 " ipm %0\n"
220234 " srl %0,28\n"
221235 : "=d" (cc)
222
- : "Q" (*val), "d" (num)
236
+ : "Q" (*dest), "d" (range), "i" (set)
223237 : "cc", "memory");
224238 return cc;
225239 }
....@@ -299,7 +313,7 @@
299313 return (unsigned long *) ret;
300314 }
301315
302
-/* Return if the entry in the sample data block table (sdbt)
316
+/* Return true if the entry in the sample data block table (sdbt)
303317 * is a link to the next sdbt */
304318 static inline int is_link_entry(unsigned long *s)
305319 {