// SPDX-License-Identifier: GPL-2.0/* * Performance event support for s390x - CPU-measurement Counter Facility * * Copyright IBM Corp. 2012, 2021 * Author(s): Hendrik Brueckner <brueckner@linux.ibm.com> * Thomas Richter <tmricht@linux.ibm.com> */#define KMSG_COMPONENT "cpum_cf"#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt#include<linux/kernel.h>#include<linux/kernel_stat.h>#include<linux/percpu.h>#include<linux/notifier.h>#include<linux/init.h>#include<linux/export.h>#include<linux/miscdevice.h>#include<asm/cpu_mcf.h>#include<asm/hwctrset.h>#include<asm/debug.h>staticunsignedintcfdiag_cpu_speed;/* CPU speed for CF_DIAG trailer */staticdebug_info_t*cf_dbg;#define CF_DIAG_CTRSET_DEF 0xfeef /* Counter set header mark *//* interval in seconds *//* Counter sets are stored as data stream in a page sized memory buffer and * exported to user space via raw data attached to the event sample data. * Each counter set starts with an eight byte header consisting of: * - a two byte eye catcher (0xfeef) * - a one byte counter set number * - a two byte counter set size (indicates the number of counters in this set) * - a three byte reserved value (must be zero) to make the header the same * size as a counter value. * All counter values are eight byte in size. * * All counter sets are followed by a 64 byte trailer. * The trailer consists of a: