1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */ 2 /* Copyright (c) 2026 Imagination Technologies Ltd. */ 3 4 #undef TRACE_SYSTEM 5 #define TRACE_SYSTEM pvr 6 7 #if !defined(PVR_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 8 #define PVR_TRACE_H 9 10 #include "pvr_context.h" 11 #include "pvr_device.h" 12 #include "pvr_fw.h" 13 #include "pvr_hwrt.h" 14 #include "pvr_job.h" 15 #include "pvr_sync.h" 16 17 #include <linux/stringify.h> 18 #include <linux/types.h> 19 #include <linux/tracepoint.h> 20 21 /* 22 * NOTE: 23 * When adding trace points, or extra data to existing ones - you must capture 24 * all the data in the TP_fast_assign section that you wish to use in the 25 * TP_printk section. This is because the printk is performed on demand from the 26 * captured data when you `cat /sys/kernel/tracing/trace` and by the time this 27 * happens any pointers you captured will likely no longer point to valid data. 28 */ 29 30 /* Job submit */ 31 32 TRACE_EVENT(pvr_job_submit_ioctl, 33 TP_PROTO(struct pvr_device *pvr_dev, u32 count), 34 TP_ARGS(pvr_dev, count), 35 TP_STRUCT__entry(__field(struct pvr_device *, pvr_dev) 36 __field(u32, count)), 37 TP_fast_assign(__entry->pvr_dev = pvr_dev; 38 __entry->count = count;), 39 TP_printk("pvr_dev=%p count=%u", 40 __entry->pvr_dev, 41 __entry->count) 42 ); 43 44 #define PVR_JOB_TYPE_TO_STR(val) \ 45 __print_symbolic(val, \ 46 { DRM_PVR_JOB_TYPE_GEOMETRY, "geometry" }, \ 47 { DRM_PVR_JOB_TYPE_FRAGMENT, "fragment" }, \ 48 { DRM_PVR_JOB_TYPE_COMPUTE, "compute" }, \ 49 { DRM_PVR_JOB_TYPE_TRANSFER_FRAG, "transfer" }) 50 51 TRACE_EVENT(pvr_job_create, 52 TP_PROTO(struct pvr_device *pvr_dev, struct pvr_job *job, 53 u32 sync_op_count), 54 TP_ARGS(pvr_dev, job, sync_op_count), 55 TP_STRUCT__entry(__field(struct pvr_device *, pvr_dev) 56 __field(struct pvr_context *, ctx) 57 __field(struct pvr_fw_object *, fw_obj) 58 __field(u32, fw_addr) 59 __field(u32, hwrt_addr) 60 __field(struct pvr_job *, job) 61 __field(enum drm_pvr_job_type, job_type) 62 __field(u32, sync_op_count)), 63 TP_fast_assign(__entry->pvr_dev = pvr_dev; 64 __entry->ctx = job->ctx; 65 __entry->fw_obj = job->ctx->fw_obj; 66 pvr_fw_object_get_fw_addr(job->ctx->fw_obj, &__entry->fw_addr); 67 __entry->hwrt_addr = job->hwrt ? 68 job->hwrt->fw_obj->fw_addr_offset : 69 0; 70 __entry->job = job; 71 __entry->job_type = job->type; 72 __entry->sync_op_count = sync_op_count;), 73 TP_printk("pvr_dev=%p ctx=%p fw_obj=%p fw_addr=0x%x hwrt_addr=0x%x job=%p job_type=%s sync_op_count=%u", 74 __entry->pvr_dev, 75 __entry->ctx, 76 __entry->fw_obj, 77 __entry->fw_addr, 78 __entry->hwrt_addr, 79 __entry->job, 80 PVR_JOB_TYPE_TO_STR(__entry->job_type), 81 __entry->sync_op_count) 82 ); 83 84 #undef PVR_JOB_TYPE_TO_STR 85 86 TRACE_EVENT(pvr_job_submit_fw, 87 TP_PROTO(struct pvr_job *job), 88 TP_ARGS(job), 89 TP_STRUCT__entry(__field(struct pvr_job *, job) 90 __field(u32, done_seqno)), 91 TP_fast_assign(__entry->job = job; 92 __entry->done_seqno = job->done_fence->seqno;), 93 TP_printk("job=%p done_seqno=%u", 94 __entry->job, 95 __entry->done_seqno) 96 ); 97 98 TRACE_EVENT(pvr_job_done, 99 TP_PROTO(struct pvr_job *job), 100 TP_ARGS(job), 101 TP_STRUCT__entry(__field(struct pvr_job *, job)), 102 TP_fast_assign(__entry->job = job;), 103 TP_printk("job=%p", __entry->job) 104 ); 105 106 #endif /* PVR_TRACE_H */ 107 108 /* This part must be outside protection */ 109 #undef TRACE_INCLUDE_PATH 110 #undef TRACE_INCLUDE_FILE 111 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/imagination 112 #define TRACE_INCLUDE_FILE pvr_trace 113 #include <trace/define_trace.h> 114