diff options
author | Hendrik Brueckner <brueckner@linux.ibm.com> | 2018-10-25 16:58:15 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-02-22 09:19:54 +0100 |
commit | 869f4f98fafadddb3a871b9513f24a44479d8296 (patch) | |
tree | 144ab4e9a70e7228393f08252a57a9c6f4aa8166 /arch/s390 | |
parent | s390/cpu_mf: replace stcctm5() with the stcctm() function (diff) | |
download | linux-869f4f98fafadddb3a871b9513f24a44479d8296.tar.xz linux-869f4f98fafadddb3a871b9513f24a44479d8296.zip |
s390/cpum_cf: introduce kernel_cpumcf_avail() function
A preparation to move out common CPU-MF counter facility support
functions, first introduce a function that indicates whether the
support is ready to use.
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/cpu_mcf.h | 1 | ||||
-rw-r--r-- | arch/s390/kernel/perf_cpum_cf.c | 20 |
2 files changed, 18 insertions, 3 deletions
diff --git a/arch/s390/include/asm/cpu_mcf.h b/arch/s390/include/asm/cpu_mcf.h index 12a4224560bc..7121365a85d9 100644 --- a/arch/s390/include/asm/cpu_mcf.h +++ b/arch/s390/include/asm/cpu_mcf.h @@ -59,6 +59,7 @@ struct cpu_cf_events { }; DECLARE_PER_CPU(struct cpu_cf_events, cpu_cf_events); +bool kernel_cpumcf_avail(void); int __kernel_cpumcf_begin(void); unsigned long kernel_cpumcf_alert(int clear); void __kernel_cpumcf_end(void); diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c index c05f69142ce4..ab4b8c904d01 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c @@ -33,6 +33,9 @@ DEFINE_PER_CPU(struct cpu_cf_events, cpu_cf_events) = { .txn_flags = 0, }; +/* Indicator whether the CPU-Measurement Counter Facility Support is ready */ +static bool cpum_cf_initalized; + static enum cpumf_ctr_set get_counter_set(u64 event) { int set = CPUMF_CTR_SET_MAX; @@ -233,6 +236,12 @@ static void setup_pmc_cpu(void *flags) lcctl(0); } +bool kernel_cpumcf_avail(void) +{ + return cpum_cf_initalized; +} +EXPORT_SYMBOL(kernel_cpumcf_avail); + /* Reserve/release functions for sharing perf hardware */ static DEFINE_SPINLOCK(cpumcf_owner_lock); static void *cpumcf_owner; @@ -709,8 +718,13 @@ static int __init cpumf_pmu_init(void) cpumf_measurement_alert); return rc; } - return cpuhp_setup_state(CPUHP_AP_PERF_S390_CF_ONLINE, - "perf/s390/cf:online", - s390_pmu_online_cpu, s390_pmu_offline_cpu); + + rc = cpuhp_setup_state(CPUHP_AP_PERF_S390_CF_ONLINE, + "perf/s390/cf:online", + s390_pmu_online_cpu, s390_pmu_offline_cpu); + if (!rc) + cpum_cf_initalized = true; + + return rc; } early_initcall(cpumf_pmu_init); |