~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/s390/include/asm/cpu_mcf.h

Version: ~ [ linux-5.15-rc5 ] ~ [ linux-5.14.11 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.72 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.152 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.210 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.250 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.286 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.288 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Counter facility support definitions for the Linux perf
  4  *
  5  * Copyright IBM Corp. 2019
  6  * Author(s): Hendrik Brueckner <brueckner@linux.ibm.com>
  7  */
  8 #ifndef _ASM_S390_CPU_MCF_H
  9 #define _ASM_S390_CPU_MCF_H
 10 
 11 #include <linux/perf_event.h>
 12 #include <asm/cpu_mf.h>
 13 
 14 enum cpumf_ctr_set {
 15         CPUMF_CTR_SET_BASIC   = 0,    /* Basic Counter Set */
 16         CPUMF_CTR_SET_USER    = 1,    /* Problem-State Counter Set */
 17         CPUMF_CTR_SET_CRYPTO  = 2,    /* Crypto-Activity Counter Set */
 18         CPUMF_CTR_SET_EXT     = 3,    /* Extended Counter Set */
 19         CPUMF_CTR_SET_MT_DIAG = 4,    /* MT-diagnostic Counter Set */
 20 
 21         /* Maximum number of counter sets */
 22         CPUMF_CTR_SET_MAX,
 23 };
 24 
 25 #define CPUMF_LCCTL_ENABLE_SHIFT    16
 26 #define CPUMF_LCCTL_ACTCTL_SHIFT     0
 27 
 28 static inline void ctr_set_enable(u64 *state, u64 ctrsets)
 29 {
 30         *state |= ctrsets << CPUMF_LCCTL_ENABLE_SHIFT;
 31 }
 32 
 33 static inline void ctr_set_disable(u64 *state, u64 ctrsets)
 34 {
 35         *state &= ~(ctrsets << CPUMF_LCCTL_ENABLE_SHIFT);
 36 }
 37 
 38 static inline void ctr_set_start(u64 *state, u64 ctrsets)
 39 {
 40         *state |= ctrsets << CPUMF_LCCTL_ACTCTL_SHIFT;
 41 }
 42 
 43 static inline void ctr_set_stop(u64 *state, u64 ctrsets)
 44 {
 45         *state &= ~(ctrsets << CPUMF_LCCTL_ACTCTL_SHIFT);
 46 }
 47 
 48 static inline int ctr_stcctm(enum cpumf_ctr_set set, u64 range, u64 *dest)
 49 {
 50         switch (set) {
 51         case CPUMF_CTR_SET_BASIC:
 52                 return stcctm(BASIC, range, dest);
 53         case CPUMF_CTR_SET_USER:
 54                 return stcctm(PROBLEM_STATE, range, dest);
 55         case CPUMF_CTR_SET_CRYPTO:
 56                 return stcctm(CRYPTO_ACTIVITY, range, dest);
 57         case CPUMF_CTR_SET_EXT:
 58                 return stcctm(EXTENDED, range, dest);
 59         case CPUMF_CTR_SET_MT_DIAG:
 60                 return stcctm(MT_DIAG_CLEARING, range, dest);
 61         case CPUMF_CTR_SET_MAX:
 62                 return 3;
 63         }
 64         return 3;
 65 }
 66 
 67 struct cpu_cf_events {
 68         struct cpumf_ctr_info   info;
 69         atomic_t                ctr_set[CPUMF_CTR_SET_MAX];
 70         atomic64_t              alert;
 71         u64                     state;          /* For perf_event_open SVC */
 72         u64                     dev_state;      /* For /dev/hwctr */
 73         unsigned int            flags;
 74         size_t used;                    /* Bytes used in data */
 75         size_t usedss;                  /* Bytes used in start/stop */
 76         unsigned char start[PAGE_SIZE]; /* Counter set at event add */
 77         unsigned char stop[PAGE_SIZE];  /* Counter set at event delete */
 78         unsigned char data[PAGE_SIZE];  /* Counter set at /dev/hwctr */
 79         unsigned int sets;              /* # Counter set saved in memory */
 80 };
 81 DECLARE_PER_CPU(struct cpu_cf_events, cpu_cf_events);
 82 
 83 bool kernel_cpumcf_avail(void);
 84 int __kernel_cpumcf_begin(void);
 85 unsigned long kernel_cpumcf_alert(int clear);
 86 void __kernel_cpumcf_end(void);
 87 
 88 static inline int kernel_cpumcf_begin(void)
 89 {
 90         if (!cpum_cf_avail())
 91                 return -ENODEV;
 92 
 93         preempt_disable();
 94         return __kernel_cpumcf_begin();
 95 }
 96 static inline void kernel_cpumcf_end(void)
 97 {
 98         __kernel_cpumcf_end();
 99         preempt_enable();
100 }
101 
102 /* Return true if store counter set multiple instruction is available */
103 static inline int stccm_avail(void)
104 {
105         return test_facility(142);
106 }
107 
108 size_t cpum_cf_ctrset_size(enum cpumf_ctr_set ctrset,
109                            struct cpumf_ctr_info *info);
110 int cfset_online_cpu(unsigned int cpu);
111 int cfset_offline_cpu(unsigned int cpu);
112 #endif /* _ASM_S390_CPU_MCF_H */
113 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp