162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright(c) 2018 Intel Corporation.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#if !defined(__HFI1_TRACE_IOWAIT_H) || defined(TRACE_HEADER_MULTI_READ)
762306a36Sopenharmony_ci#define __HFI1_TRACE_IOWAIT_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/tracepoint.h>
1062306a36Sopenharmony_ci#include "iowait.h"
1162306a36Sopenharmony_ci#include "verbs.h"
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#undef TRACE_SYSTEM
1462306a36Sopenharmony_ci#define TRACE_SYSTEM hfi1_iowait
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciDECLARE_EVENT_CLASS(hfi1_iowait_template,
1762306a36Sopenharmony_ci		    TP_PROTO(struct iowait *wait, u32 flag),
1862306a36Sopenharmony_ci		    TP_ARGS(wait, flag),
1962306a36Sopenharmony_ci		    TP_STRUCT__entry(/* entry */
2062306a36Sopenharmony_ci			    __field(unsigned long, addr)
2162306a36Sopenharmony_ci			    __field(unsigned long, flags)
2262306a36Sopenharmony_ci			    __field(u32, flag)
2362306a36Sopenharmony_ci			    __field(u32, qpn)
2462306a36Sopenharmony_ci			    ),
2562306a36Sopenharmony_ci		    TP_fast_assign(/* assign */
2662306a36Sopenharmony_ci			    __entry->addr = (unsigned long)wait;
2762306a36Sopenharmony_ci			    __entry->flags = wait->flags;
2862306a36Sopenharmony_ci			    __entry->flag = (1 << flag);
2962306a36Sopenharmony_ci			    __entry->qpn = iowait_to_qp(wait)->ibqp.qp_num;
3062306a36Sopenharmony_ci			    ),
3162306a36Sopenharmony_ci		    TP_printk(/* print */
3262306a36Sopenharmony_ci			    "iowait 0x%lx qp %u flags 0x%lx flag 0x%x",
3362306a36Sopenharmony_ci			    __entry->addr,
3462306a36Sopenharmony_ci			    __entry->qpn,
3562306a36Sopenharmony_ci			    __entry->flags,
3662306a36Sopenharmony_ci			    __entry->flag
3762306a36Sopenharmony_ci			    )
3862306a36Sopenharmony_ci	);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciDEFINE_EVENT(hfi1_iowait_template, hfi1_iowait_set,
4162306a36Sopenharmony_ci	     TP_PROTO(struct iowait *wait, u32 flag),
4262306a36Sopenharmony_ci	     TP_ARGS(wait, flag));
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciDEFINE_EVENT(hfi1_iowait_template, hfi1_iowait_clear,
4562306a36Sopenharmony_ci	     TP_PROTO(struct iowait *wait, u32 flag),
4662306a36Sopenharmony_ci	     TP_ARGS(wait, flag));
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#endif /* __HFI1_TRACE_IOWAIT_H */
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#undef TRACE_INCLUDE_PATH
5162306a36Sopenharmony_ci#undef TRACE_INCLUDE_FILE
5262306a36Sopenharmony_ci#define TRACE_INCLUDE_PATH .
5362306a36Sopenharmony_ci#define TRACE_INCLUDE_FILE trace_iowait
5462306a36Sopenharmony_ci#include <trace/define_trace.h>
55