cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

trace.h (7646B)


      1/* SPDX-License-Identifier: BSD-3-Clause-Clear */
      2/*
      3 * Copyright (c) 2019 The Linux Foundation. All rights reserved.
      4 */
      5
      6#if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
      7
      8#include <linux/tracepoint.h>
      9#include "core.h"
     10
     11#define _TRACE_H_
     12
     13/* create empty functions when tracing is disabled */
     14#if !defined(CONFIG_ATH11K_TRACING)
     15#undef TRACE_EVENT
     16#define TRACE_EVENT(name, proto, ...) \
     17static inline void trace_ ## name(proto) {} \
     18static inline bool trace_##name##_enabled(void) \
     19{						\
     20	return false;				\
     21}
     22
     23#undef DECLARE_EVENT_CLASS
     24#define DECLARE_EVENT_CLASS(...)
     25#undef DEFINE_EVENT
     26#define DEFINE_EVENT(evt_class, name, proto, ...) \
     27static inline void trace_ ## name(proto) {}
     28#endif /* !CONFIG_ATH11K_TRACING || __CHECKER__ */
     29
     30#undef TRACE_SYSTEM
     31#define TRACE_SYSTEM ath11k
     32
     33#define ATH11K_MSG_MAX 400
     34
     35TRACE_EVENT(ath11k_htt_pktlog,
     36	    TP_PROTO(struct ath11k *ar, const void *buf, u16 buf_len,
     37		     u32 pktlog_checksum),
     38
     39	TP_ARGS(ar, buf, buf_len, pktlog_checksum),
     40
     41	TP_STRUCT__entry(
     42		__string(device, dev_name(ar->ab->dev))
     43		__string(driver, dev_driver_string(ar->ab->dev))
     44		__field(u16, buf_len)
     45		__field(u32, pktlog_checksum)
     46		__dynamic_array(u8, pktlog, buf_len)
     47	),
     48
     49	TP_fast_assign(
     50		__assign_str(device, dev_name(ar->ab->dev));
     51		__assign_str(driver, dev_driver_string(ar->ab->dev));
     52		__entry->buf_len = buf_len;
     53		__entry->pktlog_checksum = pktlog_checksum;
     54		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
     55	),
     56
     57	TP_printk(
     58		"%s %s size %u pktlog_checksum %d",
     59		__get_str(driver),
     60		__get_str(device),
     61		__entry->buf_len,
     62		__entry->pktlog_checksum
     63	 )
     64);
     65
     66TRACE_EVENT(ath11k_htt_ppdu_stats,
     67	    TP_PROTO(struct ath11k *ar, const void *data, size_t len),
     68
     69	TP_ARGS(ar, data, len),
     70
     71	TP_STRUCT__entry(
     72		__string(device, dev_name(ar->ab->dev))
     73		__string(driver, dev_driver_string(ar->ab->dev))
     74		__field(u16, len)
     75		__dynamic_array(u8, ppdu, len)
     76	),
     77
     78	TP_fast_assign(
     79		__assign_str(device, dev_name(ar->ab->dev));
     80		__assign_str(driver, dev_driver_string(ar->ab->dev));
     81		__entry->len = len;
     82		memcpy(__get_dynamic_array(ppdu), data, len);
     83	),
     84
     85	TP_printk(
     86		"%s %s ppdu len %d",
     87		__get_str(driver),
     88		__get_str(device),
     89		__entry->len
     90	 )
     91);
     92
     93TRACE_EVENT(ath11k_htt_rxdesc,
     94	    TP_PROTO(struct ath11k *ar, const void *data, size_t log_type, size_t len),
     95
     96	TP_ARGS(ar, data, log_type, len),
     97
     98	TP_STRUCT__entry(
     99		__string(device, dev_name(ar->ab->dev))
    100		__string(driver, dev_driver_string(ar->ab->dev))
    101		__field(u16, len)
    102		__field(u16, log_type)
    103		__dynamic_array(u8, rxdesc, len)
    104	),
    105
    106	TP_fast_assign(
    107		__assign_str(device, dev_name(ar->ab->dev));
    108		__assign_str(driver, dev_driver_string(ar->ab->dev));
    109		__entry->len = len;
    110		__entry->log_type = log_type;
    111		memcpy(__get_dynamic_array(rxdesc), data, len);
    112	),
    113
    114	TP_printk(
    115		"%s %s rxdesc len %d type %d",
    116		__get_str(driver),
    117		__get_str(device),
    118		__entry->len,
    119		__entry->log_type
    120	 )
    121);
    122
    123DECLARE_EVENT_CLASS(ath11k_log_event,
    124		    TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
    125	TP_ARGS(ab, vaf),
    126	TP_STRUCT__entry(
    127		__string(device, dev_name(ab->dev))
    128		__string(driver, dev_driver_string(ab->dev))
    129		__dynamic_array(char, msg, ATH11K_MSG_MAX)
    130	),
    131	TP_fast_assign(
    132		__assign_str(device, dev_name(ab->dev));
    133		__assign_str(driver, dev_driver_string(ab->dev));
    134		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
    135				       ATH11K_MSG_MAX,
    136				       vaf->fmt,
    137				       *vaf->va) >= ATH11K_MSG_MAX);
    138	),
    139	TP_printk(
    140		"%s %s %s",
    141		__get_str(driver),
    142		__get_str(device),
    143		__get_str(msg)
    144	)
    145);
    146
    147DEFINE_EVENT(ath11k_log_event, ath11k_log_err,
    148	     TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
    149	     TP_ARGS(ab, vaf)
    150);
    151
    152DEFINE_EVENT(ath11k_log_event, ath11k_log_warn,
    153	     TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
    154	     TP_ARGS(ab, vaf)
    155);
    156
    157DEFINE_EVENT(ath11k_log_event, ath11k_log_info,
    158	     TP_PROTO(struct ath11k_base *ab, struct va_format *vaf),
    159	     TP_ARGS(ab, vaf)
    160);
    161
    162TRACE_EVENT(ath11k_wmi_cmd,
    163	    TP_PROTO(struct ath11k_base *ab, int id, const void *buf, size_t buf_len),
    164
    165	TP_ARGS(ab, id, buf, buf_len),
    166
    167	TP_STRUCT__entry(
    168		__string(device, dev_name(ab->dev))
    169		__string(driver, dev_driver_string(ab->dev))
    170		__field(unsigned int, id)
    171		__field(size_t, buf_len)
    172		__dynamic_array(u8, buf, buf_len)
    173	),
    174
    175	TP_fast_assign(
    176		__assign_str(device, dev_name(ab->dev));
    177		__assign_str(driver, dev_driver_string(ab->dev));
    178		__entry->id = id;
    179		__entry->buf_len = buf_len;
    180		memcpy(__get_dynamic_array(buf), buf, buf_len);
    181	),
    182
    183	TP_printk(
    184		"%s %s id %d len %zu",
    185		__get_str(driver),
    186		__get_str(device),
    187		__entry->id,
    188		__entry->buf_len
    189	 )
    190);
    191
    192TRACE_EVENT(ath11k_wmi_event,
    193	    TP_PROTO(struct ath11k_base *ab, int id, const void *buf, size_t buf_len),
    194
    195	TP_ARGS(ab, id, buf, buf_len),
    196
    197	TP_STRUCT__entry(
    198		__string(device, dev_name(ab->dev))
    199		__string(driver, dev_driver_string(ab->dev))
    200		__field(unsigned int, id)
    201		__field(size_t, buf_len)
    202		__dynamic_array(u8, buf, buf_len)
    203	),
    204
    205	TP_fast_assign(
    206		__assign_str(device, dev_name(ab->dev));
    207		__assign_str(driver, dev_driver_string(ab->dev));
    208		__entry->id = id;
    209		__entry->buf_len = buf_len;
    210		memcpy(__get_dynamic_array(buf), buf, buf_len);
    211	),
    212
    213	TP_printk(
    214		"%s %s id %d len %zu",
    215		__get_str(driver),
    216		__get_str(device),
    217		__entry->id,
    218		__entry->buf_len
    219	)
    220);
    221
    222TRACE_EVENT(ath11k_log_dbg,
    223	    TP_PROTO(struct ath11k_base *ab, unsigned int level, struct va_format *vaf),
    224
    225	TP_ARGS(ab, level, vaf),
    226
    227	TP_STRUCT__entry(
    228		__string(device, dev_name(ab->dev))
    229		__string(driver, dev_driver_string(ab->dev))
    230		__field(unsigned int, level)
    231		__dynamic_array(char, msg, ATH11K_MSG_MAX)
    232	),
    233
    234	TP_fast_assign(
    235		__assign_str(device, dev_name(ab->dev));
    236		__assign_str(driver, dev_driver_string(ab->dev));
    237		__entry->level = level;
    238		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
    239				       ATH11K_MSG_MAX, vaf->fmt,
    240				       *vaf->va) >= ATH11K_MSG_MAX);
    241	),
    242
    243	TP_printk(
    244		"%s %s %s",
    245		__get_str(driver),
    246		__get_str(device),
    247		__get_str(msg)
    248	)
    249);
    250
    251TRACE_EVENT(ath11k_log_dbg_dump,
    252	    TP_PROTO(struct ath11k_base *ab, const char *msg, const char *prefix,
    253		     const void *buf, size_t buf_len),
    254
    255	TP_ARGS(ab, msg, prefix, buf, buf_len),
    256
    257	TP_STRUCT__entry(
    258		__string(device, dev_name(ab->dev))
    259		__string(driver, dev_driver_string(ab->dev))
    260		__string(msg, msg)
    261		__string(prefix, prefix)
    262		__field(size_t, buf_len)
    263		__dynamic_array(u8, buf, buf_len)
    264	),
    265
    266	TP_fast_assign(
    267		__assign_str(device, dev_name(ab->dev));
    268		__assign_str(driver, dev_driver_string(ab->dev));
    269		__assign_str(msg, msg);
    270		__assign_str(prefix, prefix);
    271		__entry->buf_len = buf_len;
    272		memcpy(__get_dynamic_array(buf), buf, buf_len);
    273	),
    274
    275	TP_printk(
    276		"%s %s %s/%s\n",
    277		__get_str(driver),
    278		__get_str(device),
    279		__get_str(prefix),
    280		__get_str(msg)
    281	)
    282);
    283
    284TRACE_EVENT(ath11k_wmi_diag,
    285	    TP_PROTO(struct ath11k_base *ab, const void *data, size_t len),
    286
    287	TP_ARGS(ab, data, len),
    288
    289	TP_STRUCT__entry(
    290		__string(device, dev_name(ab->dev))
    291		__string(driver, dev_driver_string(ab->dev))
    292		__field(u16, len)
    293		__dynamic_array(u8, data, len)
    294	),
    295
    296	TP_fast_assign(
    297		__assign_str(device, dev_name(ab->dev));
    298		__assign_str(driver, dev_driver_string(ab->dev));
    299		__entry->len = len;
    300		memcpy(__get_dynamic_array(data), data, len);
    301	),
    302
    303	TP_printk(
    304		"%s %s tlv diag len %d",
    305		__get_str(driver),
    306		__get_str(device),
    307		__entry->len
    308	)
    309);
    310
    311#endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
    312
    313/* we don't want to use include/trace/events */
    314#undef TRACE_INCLUDE_PATH
    315#define TRACE_INCLUDE_PATH .
    316#undef TRACE_INCLUDE_FILE
    317#define TRACE_INCLUDE_FILE trace
    318
    319/* This part must be outside protection */
    320#include <trace/define_trace.h>