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 		 unsigned int cpu_id,
31 		 bool changed,
32 		 bool fast_switch
33 		 ),
34 
35 	TP_ARGS(min_perf,
36 		target_perf,
37 		capacity,
38 		cpu_id,
39 		changed,
40 		fast_switch
41 		),
42 
43 	TP_STRUCT__entry(
44 		__field(unsigned long, min_perf)
45 		__field(unsigned long, target_perf)
46 		__field(unsigned long, capacity)
47 		__field(unsigned int, cpu_id)
48 		__field(bool, changed)
49 		__field(bool, fast_switch)
50 		),
51 
52 	TP_fast_assign(
53 		__entry->min_perf = min_perf;
54 		__entry->target_perf = target_perf;
55 		__entry->capacity = capacity;
56 		__entry->cpu_id = cpu_id;
57 		__entry->changed = changed;
58 		__entry->fast_switch = fast_switch;
59 		),
60 
61 	TP_printk("amd_min_perf=%lu amd_des_perf=%lu amd_max_perf=%lu cpu_id=%u changed=%s fast_switch=%s",
62 		  (unsigned long)__entry->min_perf,
63 		  (unsigned long)__entry->target_perf,
64 		  (unsigned long)__entry->capacity,
65 		  (unsigned int)__entry->cpu_id,
66 		  (__entry->changed) ? "true" : "false",
67 		  (__entry->fast_switch) ? "true" : "false"
68 		 )
69 );
70 
71 #endif /* _AMD_PSTATE_TRACE_H */
72 
73 /* This part must be outside protection */
74 #undef TRACE_INCLUDE_PATH
75 #define TRACE_INCLUDE_PATH .
76 
77 #include <trace/define_trace.h>
78