new file mode 100644
@@ -0,0 +1,493 @@
+/* SPDX-License-Identifier: GPL-2.0-only
+ *
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#if !defined(_TRACE_QAIC_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_QAIC_H
+#include <linux/tracepoint.h>
+#include <uapi/drm/qaic_drm.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM qaic
+#define TRACE_INCLUDE_FILE qaic_trace
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/qaic
+
+TRACE_EVENT(qaic_ioctl,
+ TP_PROTO(struct qaic_device *qdev, struct qaic_user *usr,
+ unsigned int cmd, bool in),
+ TP_ARGS(qdev, usr, cmd, in),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(unsigned int, user)
+ __field(unsigned int, cmd)
+ __field(unsigned int, type)
+ __field(unsigned int, nr)
+ __field(unsigned int, size)
+ __field(unsigned int, dir)
+ __field(bool, in)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->user = usr->handle;
+ __entry->cmd = cmd;
+ __entry->type = _IOC_TYPE(cmd);
+ __entry->nr = _IOC_NR(cmd);
+ __entry->size = _IOC_SIZE(cmd);
+ __entry->dir = _IOC_DIR(cmd);
+ __entry->in = in;
+ ),
+ TP_printk("%s:%s user:%d cmd:0x%x (%c nr=%d len=%d dir=%d)",
+ __entry->in ? "Entry" : "Exit", __get_str(device),
+ __entry->user, __entry->cmd, __entry->type, __entry->nr,
+ __entry->size, __entry->dir)
+);
+
+TRACE_EVENT(qaic_mhi_queue_error,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __string(msg, msg)
+ __field(int, ret)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __assign_str(msg, msg);
+ __entry->ret = ret;
+ ),
+ TP_printk("%s %s %d",
+ __get_str(device), __get_str(msg), __entry->ret)
+);
+
+DECLARE_EVENT_CLASS(qaic_manage_error,
+ TP_PROTO(struct qaic_device *qdev, struct qaic_user *usr,
+ const char *msg),
+ TP_ARGS(qdev, usr, msg),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(unsigned int, user)
+ __string(msg, msg)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->user = usr->handle;
+ __assign_str(msg, msg);
+ ),
+ TP_printk("%s user:%d %s",
+ __get_str(device), __entry->user, __get_str(msg))
+);
+
+DEFINE_EVENT(qaic_manage_error, manage_error,
+ TP_PROTO(struct qaic_device *qdev, struct qaic_user *usr,
+ const char *msg),
+ TP_ARGS(qdev, usr, msg)
+);
+
+DECLARE_EVENT_CLASS(qaic_encdec_error,
+ TP_PROTO(struct qaic_device *qdev, const char *msg),
+ TP_ARGS(qdev, msg),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __string(msg, msg)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __assign_str(msg, msg);
+ ),
+ TP_printk("%s %s", __get_str(device), __get_str(msg))
+);
+
+DEFINE_EVENT(qaic_encdec_error, encode_error,
+ TP_PROTO(struct qaic_device *qdev, const char *msg),
+ TP_ARGS(qdev, msg)
+);
+
+DEFINE_EVENT(qaic_encdec_error, decode_error,
+ TP_PROTO(struct qaic_device *qdev, const char *msg),
+ TP_ARGS(qdev, msg)
+);
+
+TRACE_EVENT(qaic_control_dbg,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __string(msg, msg)
+ __field(int, ret)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __assign_str(msg, msg);
+ __entry->ret = ret;
+ ),
+ TP_printk("%s %s %d",
+ __get_str(device), __get_str(msg), __entry->ret)
+);
+
+TRACE_EVENT(qaic_encode_passthrough,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_passthrough *in_trans),
+ TP_ARGS(qdev, in_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = in_trans->hdr.len;
+ ),
+ TP_printk("%s len %u", __get_str(device), __entry->len)
+);
+
+TRACE_EVENT(qaic_encode_dma,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_dma_xfer *in_trans),
+ TP_ARGS(qdev, in_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ __field(__u32, tag)
+ __field(__u32, count)
+ __field(__u64, addr)
+ __field(__u64, size)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = in_trans->hdr.len;
+ __entry->tag = in_trans->tag;
+ __entry->count = in_trans->count;
+ __entry->addr = in_trans->addr;
+ __entry->size = in_trans->size;
+ ),
+ TP_printk("%s len %u tag %u count %u address 0x%llx size %llu",
+ __get_str(device), __entry->len, __entry->tag, __entry->count,
+ __entry->addr, __entry->size)
+);
+
+TRACE_EVENT(qaic_encode_activate,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_activate_to_dev *in_trans),
+ TP_ARGS(qdev, in_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ __field(__u32, queue_size)
+ __field(__u32, eventfd)
+ __field(__u32, options)
+ __field(__u32, pad)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = in_trans->hdr.len;
+ __entry->queue_size = in_trans->queue_size;
+ __entry->eventfd = in_trans->eventfd;
+ __entry->options = in_trans->options;
+ __entry->pad = in_trans->pad;
+ ),
+ TP_printk("%s len %u queue_size %u eventfd %u options %u pad %u",
+ __get_str(device), __entry->len, __entry->queue_size,
+ __entry->eventfd, __entry->options, __entry->pad)
+);
+
+TRACE_EVENT(qaic_encode_deactivate,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_deactivate *in_trans),
+ TP_ARGS(qdev, in_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ __field(__u32, dbc_id)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = in_trans->hdr.len;
+ __entry->dbc_id = in_trans->dbc_id;
+ ),
+ TP_printk("%s len %u dbc_id %u",
+ __get_str(device), __entry->len, __entry->dbc_id)
+);
+
+TRACE_EVENT(qaic_encode_status,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_status_to_dev *in_trans),
+ TP_ARGS(qdev, in_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = in_trans->hdr.len;
+ ),
+ TP_printk("%s len %u", __get_str(device), __entry->len)
+);
+
+TRACE_EVENT(qaic_decode_passthrough,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_passthrough *out_trans),
+ TP_ARGS(qdev, out_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = out_trans->hdr.len;
+ ),
+ TP_printk("%s len %u", __get_str(device), __entry->len)
+);
+
+TRACE_EVENT(qaic_decode_activate,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_activate_from_dev *out_trans),
+ TP_ARGS(qdev, out_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ __field(__u32, status)
+ __field(__u32, dbc_id)
+ __field(__u64, options)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = out_trans->hdr.len;
+ __entry->status = out_trans->status;
+ __entry->dbc_id = out_trans->dbc_id;
+ __entry->options = out_trans->options;
+ ),
+ TP_printk("%s len %u status %u dbc_id %u options %llu",
+ __get_str(device), __entry->len, __entry->status,
+ __entry->dbc_id, __entry->options)
+);
+
+TRACE_EVENT(qaic_decode_deactivate,
+ TP_PROTO(struct qaic_device *qdev, u32 dbc_id, u32 status),
+ TP_ARGS(qdev, dbc_id, status),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(u32, dbc_id)
+ __field(u32, status)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->dbc_id = dbc_id;
+ __entry->status = status;
+ ),
+ TP_printk("%s dbc_id %u status %u",
+ __get_str(device), __entry->dbc_id, __entry->status)
+);
+
+TRACE_EVENT(qaic_decode_status,
+ TP_PROTO(struct qaic_device *qdev,
+ struct qaic_manage_trans_status_from_dev *out_trans),
+ TP_ARGS(qdev, out_trans),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __field(__u32, len)
+ __field(__u16, major)
+ __field(__u16, minor)
+ __field(__u32, status)
+ __field(__u64, status_flags)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __entry->len = out_trans->hdr.len;
+ __entry->major = out_trans->major;
+ __entry->minor = out_trans->minor;
+ __entry->status = out_trans->status;
+ __entry->status_flags = out_trans->status_flags;
+ ),
+ TP_printk("%s len %u major %u minor %u status %u flags 0x%llx",
+ __get_str(device), __entry->len, __entry->major, __entry->minor,
+ __entry->status, __entry->status_flags)
+);
+
+DECLARE_EVENT_CLASS(qaic_data_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __string(msg, msg)
+ __field(int, ret)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __assign_str(msg, msg);
+ __entry->ret = ret;
+ ),
+ TP_printk("%s %s %d", __get_str(device), __get_str(msg), __entry->ret)
+);
+
+DEFINE_EVENT(qaic_data_err, qaic_mem_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret)
+);
+
+DEFINE_EVENT(qaic_data_err, qaic_mmap_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret)
+);
+
+DEFINE_EVENT(qaic_data_err, qaic_exec_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret)
+);
+
+DEFINE_EVENT(qaic_data_err, qaic_wait_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret)
+);
+
+DEFINE_EVENT(qaic_data_err, qaic_stats_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret)
+);
+
+DEFINE_EVENT(qaic_data_err, qaic_util_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret)
+);
+
+DEFINE_EVENT(qaic_data_err, qaic_attach_err,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, int ret),
+ TP_ARGS(qdev, msg, ret)
+);
+
+DECLARE_EVENT_CLASS(qaic_data_err_1,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ int ret, u64 var1),
+ TP_ARGS(qdev, msg, msg_var1, ret, var1),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __string(msg, msg)
+ __string(msg_var1, msg_var1)
+ __field(int, ret)
+ __field(u64, var1)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __assign_str(msg, msg);
+ __assign_str(msg_var1, msg_var1);
+ __entry->ret = ret;
+ __entry->var1 = var1;
+ ),
+ TP_printk("%s %s Error:%d %s:%llu",
+ __get_str(device), __get_str(msg), __entry->ret,
+ __get_str(msg_var1), __entry->var1)
+);
+
+DEFINE_EVENT(qaic_data_err_1, qaic_mem_err_1,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ int ret, u64 var1),
+ TP_ARGS(qdev, msg, msg_var1, ret, var1)
+);
+
+DEFINE_EVENT(qaic_data_err_1, qaic_mmap_err_1,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ int ret, u64 var1),
+ TP_ARGS(qdev, msg, msg_var1, ret, var1)
+);
+
+DEFINE_EVENT(qaic_data_err_1, qaic_attach_err_1,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ int ret, u64 var1),
+ TP_ARGS(qdev, msg, msg_var1, ret, var1)
+);
+
+DEFINE_EVENT(qaic_data_err_1, qaic_exec_err_1,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ int ret, u64 var1),
+ TP_ARGS(qdev, msg, msg_var1, ret, var1)
+);
+
+DEFINE_EVENT(qaic_data_err_1, qaic_wait_err_1,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ int ret, u64 var1),
+ TP_ARGS(qdev, msg, msg_var1, ret, var1)
+);
+
+DEFINE_EVENT(qaic_data_err_1, qaic_stats_err_1,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ int ret, u64 var1),
+ TP_ARGS(qdev, msg, msg_var1, ret, var1)
+);
+
+DECLARE_EVENT_CLASS(qaic_data_err_2,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ const char *msg_var2, int ret, u64 var1, u64 var2),
+ TP_ARGS(qdev, msg, msg_var1, msg_var2, ret, var1, var2),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __string(msg, msg)
+ __string(msg_var1, msg_var1)
+ __string(msg_var2, msg_var2)
+ __field(int, ret)
+ __field(u64, var1)
+ __field(u64, var2)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __assign_str(msg, msg);
+ __assign_str(msg_var1, msg_var1);
+ __assign_str(msg_var2, msg_var2);
+ __entry->ret = ret;
+ __entry->var1 = var1;
+ __entry->var2 = var2;
+ ),
+ TP_printk("%s %s Error:%d %s:%llu %s:%llu",
+ __get_str(device), __get_str(msg), __entry->ret,
+ __get_str(msg_var1), __entry->var1,
+ __get_str(msg_var2), __entry->var2)
+);
+
+DEFINE_EVENT(qaic_data_err_2, qaic_mem_err_2,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ const char *msg_var2, int ret, u64 var1, u64 var2),
+ TP_ARGS(qdev, msg, msg_var1, msg_var2, ret, var1, var2)
+);
+
+DEFINE_EVENT(qaic_data_err_2, qaic_attach_err_2,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ const char *msg_var2, int ret, u64 var1, u64 var2),
+ TP_ARGS(qdev, msg, msg_var1, msg_var2, ret, var1, var2)
+);
+
+DEFINE_EVENT(qaic_data_err_2, qaic_exec_err_2,
+ TP_PROTO(struct qaic_device *qdev, const char *msg, const char *msg_var1,
+ const char *msg_var2, int ret, u64 var1, u64 var2),
+ TP_ARGS(qdev, msg, msg_var1, msg_var2, ret, var1, var2)
+);
+
+DECLARE_EVENT_CLASS(qaic_ssr,
+ TP_PROTO(struct qaic_device *qdev, const char *msg),
+ TP_ARGS(qdev, msg),
+ TP_STRUCT__entry(
+ __string(device, dev_name(&qdev->pdev->dev))
+ __string(msg, msg)
+ ),
+ TP_fast_assign(
+ __assign_str(device, dev_name(&qdev->pdev->dev));
+ __assign_str(msg, msg);
+ ),
+ TP_printk("%s %s", __get_str(device), __get_str(msg))
+);
+
+DEFINE_EVENT(qaic_ssr, qaic_ssr_cmd,
+ TP_PROTO(struct qaic_device *qdev, const char *msg),
+ TP_ARGS(qdev, msg)
+);
+
+DEFINE_EVENT(qaic_ssr, qaic_ssr_event,
+ TP_PROTO(struct qaic_device *qdev, const char *msg),
+ TP_ARGS(qdev, msg)
+);
+
+DEFINE_EVENT(qaic_ssr, qaic_ssr_dump,
+ TP_PROTO(struct qaic_device *qdev, const char *msg),
+ TP_ARGS(qdev, msg)
+);
+
+#endif /* _TRACE_QAIC_H */
+#include <trace/define_trace.h>
Add QAIC specific tracepoints which can be useful in debugging issues. Change-Id: I8cde015990d5a3482dbba142cf0a4bbb4512cb02 Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> --- drivers/gpu/drm/qaic/qaic_trace.h | 493 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 493 insertions(+) create mode 100644 drivers/gpu/drm/qaic/qaic_trace.h