Skip to content

Commit 1d2eabb

Browse files
alessiob-imgMTCoster
authored andcommitted
drm/imagination: Fix timestamps in firmware traces
When firmware traces are enabled, the firmware dumps 48-bit timestamps for each trace as two 32-bit values, highest 32 bits (of which only 16 useful) first. The driver was reassembling them the other way round i.e. interpreting the first value in memory as the lowest 32 bits, and the second value as the highest 32 bits (then truncated to 16 bits). Due to this, firmware trace dumps showed very large timestamps even for traces recorded shortly after GPU boot. The timestamps in these dumps would also sometimes jump backwards because of the truncation. Example trace dumped after loading the powervr module and enabling firmware traces, where each line is commented with the timestamp value in hexadecimal to better show both issues: [93540092739584] : Host Sync Partition marker: 1 // 0x551300000000 [28419798597632] : GPU units deinit // 0x19d900000000 [28548647616512] : GPU deinit // 0x19f700000000 Update logic to reassemble the timestamps halves in the correct order. Fixes: cb56cd6 ("drm/imagination: Add firmware trace to debugfs") Signed-off-by: Alessio Belle <alessio.belle@imgtec.com> Reviewed-by: Matt Coster <matt.coster@imgtec.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250221-fix-fw-trace-timestamps-v1-1-dba4aeb030ca@imgtec.com Signed-off-by: Matt Coster <matt.coster@imgtec.com>
1 parent 68c3de7 commit 1d2eabb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/imagination/pvr_fw_trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ static int fw_trace_seq_show(struct seq_file *s, void *v)
333333
if (sf_id == ROGUE_FW_SF_LAST)
334334
return -EINVAL;
335335

336-
timestamp = read_fw_trace(trace_seq_data, 1) |
337-
((u64)read_fw_trace(trace_seq_data, 2) << 32);
336+
timestamp = ((u64)read_fw_trace(trace_seq_data, 1) << 32) |
337+
read_fw_trace(trace_seq_data, 2);
338338
timestamp = (timestamp & ~ROGUE_FWT_TIMESTAMP_TIME_CLRMSK) >>
339339
ROGUE_FWT_TIMESTAMP_TIME_SHIFT;
340340

0 commit comments

Comments
 (0)