diff --git a/src/trace/dma-trace.c b/src/trace/dma-trace.c index f3d82b667f1c..8fbf99811edf 100644 --- a/src/trace/dma-trace.c +++ b/src/trace/dma-trace.c @@ -491,6 +491,8 @@ int dma_trace_enable(struct dma_trace_data *d) void dma_trace_disable(struct dma_trace_data *d) { + struct dma_trace_buf *buffer = &d->dmatb; + /* cancel trace work */ schedule_task_cancel(&d->dmat_work); @@ -507,6 +509,14 @@ void dma_trace_disable(struct dma_trace_data *d) d->host_size = 0; } #endif + + /* + * Reset the local read and write pointers to preserve the captured logs + * while the dtrace is disabed + */ + buffer->w_ptr = buffer->addr; + buffer->r_ptr = buffer->addr; + buffer->avail = 0; } /** Sends all pending DMA messages to mailbox (for emergencies) */