1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * amd-pstate-trace.h - AMD Processor P-state Frequency Driver Tracer 4 * 5 * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved. 6 * 7 * Author: Huang Rui <ray.huang@amd.com> 8 */ 9 10 #if !defined(_AMD_PSTATE_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 11 #define _AMD_PSTATE_TRACE_H 12 13 #include <linux/cpufreq.h> 14 #include <linux/tracepoint.h> 15 #include <linux/trace_events.h> 16 17 #undef TRACE_SYSTEM 18 #define TRACE_SYSTEM amd_cpu 19 20 #undef TRACE_INCLUDE_FILE 21 #define TRACE_INCLUDE_FILE amd-pstate-trace 22 23 #define TPS(x) tracepoint_string(x) 24 25 TRACE_EVENT(amd_pstate_perf, 26 27 TP_PROTO(unsigned long min_perf, 28 unsigned long target_perf, 29 unsigned long capacity, 30 u64 freq, 31 u64 mperf, 32 u64 aperf, 33 u64 tsc, 34 unsigned int cpu_id, 35 bool fast_switch 36 ), 37 38 TP_ARGS(min_perf, 39 target_perf, 40 capacity, 41 freq, 42 mperf, 43 aperf, 44 tsc, 45 cpu_id, 46 fast_switch 47 ), 48 49 TP_STRUCT__entry( 50 __field(unsigned long, min_perf) 51 __field(unsigned long, target_perf) 52 __field(unsigned long, capacity) 53 __field(unsigned long long, freq) 54 __field(unsigned long long, mperf) 55 __field(unsigned long long, aperf) 56 __field(unsigned long long, tsc) 57 __field(unsigned int, cpu_id) 58 __field(bool, fast_switch) 59 ), 60 61 TP_fast_assign( 62 __entry->min_perf = min_perf; 63 __entry->target_perf = target_perf; 64 __entry->capacity = capacity; 65 __entry->freq = freq; 66 __entry->mperf = mperf; 67 __entry->aperf = aperf; 68 __entry->tsc = tsc; 69 __entry->cpu_id = cpu_id; 70 __entry->fast_switch = fast_switch; 71 ), 72 73 TP_printk("amd_min_perf=%lu amd_des_perf=%lu amd_max_perf=%lu freq=%llu mperf=%llu aperf=%llu tsc=%llu cpu_id=%u fast_switch=%s", 74 (unsigned long)__entry->min_perf, 75 (unsigned long)__entry->target_perf, 76 (unsigned long)__entry->capacity, 77 (unsigned long long)__entry->freq, 78 (unsigned long long)__entry->mperf, 79 (unsigned long long)__entry->aperf, 80 (unsigned long long)__entry->tsc, 81 (unsigned int)__entry->cpu_id, 82 (__entry->fast_switch) ? "true" : "false" 83 ) 84 ); 85 86 TRACE_EVENT(amd_pstate_epp_perf, 87 88 TP_PROTO(unsigned int cpu_id, 89 unsigned int highest_perf, 90 unsigned int epp, 91 unsigned int min_perf, 92 unsigned int max_perf, 93 bool boost 94 ), 95 96 TP_ARGS(cpu_id, 97 highest_perf, 98 epp, 99 min_perf, 100 max_perf, 101 boost), 102 103 TP_STRUCT__entry( 104 __field(unsigned int, cpu_id) 105 __field(unsigned int, highest_perf) 106 __field(unsigned int, epp) 107 __field(unsigned int, min_perf) 108 __field(unsigned int, max_perf) 109 __field(bool, boost) 110 ), 111 112 TP_fast_assign( 113 __entry->cpu_id = cpu_id; 114 __entry->highest_perf = highest_perf; 115 __entry->epp = epp; 116 __entry->min_perf = min_perf; 117 __entry->max_perf = max_perf; 118 __entry->boost = boost; 119 ), 120 121 TP_printk("cpu%u: [%u<->%u]/%u, epp=%u, boost=%u", 122 (unsigned int)__entry->cpu_id, 123 (unsigned int)__entry->min_perf, 124 (unsigned int)__entry->max_perf, 125 (unsigned int)__entry->highest_perf, 126 (unsigned int)__entry->epp, 127 (bool)__entry->boost 128 ) 129 ); 130 131 #endif /* _AMD_PSTATE_TRACE_H */ 132 133 /* This part must be outside protection */ 134 #undef TRACE_INCLUDE_PATH 135 #define TRACE_INCLUDE_PATH . 136 137 #include <trace/define_trace.h> 138