[PATCH 2/2] hwtracing: hisi_ptt: Remove unnecessary trace buffer zeroing in trace_start()

From: Pradhan, Sanman

Date: Wed Apr 08 2026 - 21:09:10 EST


From: Sanman Pradhan <psanman@xxxxxxxxxxx>

hisi_ptt_trace_start() clears all four trace buffers before enabling
tracing.

This is unnecessary. On trace stop, hisi_ptt_update_aux() copies only
the number of bytes reported in HISI_PTT_TRACE_WR_STS. On buffer-full
interrupts, it copies a full completed buffer. In both cases the driver
only consumes data written by hardware.

Remove the buffer clearing from the trace start path.

Signed-off-by: Sanman Pradhan <psanman@xxxxxxxxxxx>
---
drivers/hwtracing/ptt/hisi_ptt.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
index 73b93df8504c4..cbfbd1f146ba3 100644
--- a/drivers/hwtracing/ptt/hisi_ptt.c
+++ b/drivers/hwtracing/ptt/hisi_ptt.c
@@ -195,7 +195,6 @@ static int hisi_ptt_trace_start(struct hisi_ptt *hisi_ptt)
struct hisi_ptt_trace_ctrl *ctrl = &hisi_ptt->trace_ctrl;
u32 val;
int ret;
- int i;

/* Check device idle before start trace */
if (!hisi_ptt_wait_trace_hw_idle(hisi_ptt)) {
@@ -221,10 +220,6 @@ static int hisi_ptt_trace_start(struct hisi_ptt *hisi_ptt)
/* Reset the index of current buffer */
hisi_ptt->trace_ctrl.buf_index = 0;

- /* Zero the trace buffers */
- for (i = 0; i < HISI_PTT_TRACE_BUF_CNT; i++)
- memset(ctrl->trace_buf[i].addr, 0, HISI_PTT_TRACE_BUF_SIZE);
-
/* Clear the interrupt status */
writel(HISI_PTT_TRACE_INT_STAT_MASK, hisi_ptt->iobase + HISI_PTT_TRACE_INT_STAT);
writel(0, hisi_ptt->iobase + HISI_PTT_TRACE_INT_MASK);
--
2.34.1