Skip to content

Commit 597194f

Browse files
authored
Merge pull request #204 from RanderWang/dma_trace_apl
trace: refine dma trace algorithm for apl
2 parents 3fea877 + bd84f96 commit 597194f

5 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/lib/dma-trace.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ static uint64_t trace_work(void *data, uint64_t delay)
5656
int32_t size;
5757
uint32_t overflow;
5858

59-
/* any data to copy ? */
60-
if (avail == 0)
61-
return DMA_TRACE_PERIOD;
62-
63-
/* DMA trace copying is working */
64-
d->copy_in_progress = 1;
65-
6659
/* make sure we don't write more than buffer */
6760
if (avail > DMA_TRACE_LOCAL_SIZE) {
6861
overflow = avail - DMA_TRACE_LOCAL_SIZE;
@@ -75,8 +68,15 @@ static uint64_t trace_work(void *data, uint64_t delay)
7568
/* support, so do it differently based on HW features */
7669
size = dma_trace_get_avali_data(d, buffer, avail);
7770

71+
/* any data to copy ? */
72+
if (size == 0)
73+
return DMA_TRACE_PERIOD;
74+
7875
d->overflow = overflow;
7976

77+
/* DMA trace copying is working */
78+
d->copy_in_progress = 1;
79+
8080
/* copy this section to host */
8181
size = dma_copy_to_host_nowait(&d->dc, config, d->host_offset,
8282
buffer->r_ptr, size);
@@ -258,6 +258,9 @@ static int dma_trace_get_avali_data(struct dma_trace_data *d,
258258
d->old_host_offset = d->host_offset;
259259
}
260260

261+
if (avail == 0)
262+
return 0;
263+
261264
/* writeback trace data */
262265
if (buffer->r_ptr + avail <= buffer->end_addr) {
263266
dcache_writeback_region((void *)buffer->r_ptr, avail);
@@ -284,6 +287,9 @@ static int dma_trace_get_avali_data(struct dma_trace_data *d,
284287
lsize = avail;
285288
hsize = avail;
286289

290+
if (avail == 0)
291+
return 0;
292+
287293
/* host buffer wrap ? */
288294
if (d->host_offset + avail > d->host_size)
289295
hsize = d->host_size - d->host_offset;

src/platform/apollolake/include/platform/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct sof;
104104
* the interval of reschedule DMA trace copying in special case like half
105105
* fullness of local DMA trace buffer
106106
*/
107-
#define DMA_TRACE_RESCHEDULE_TIME 5000
107+
#define DMA_TRACE_RESCHEDULE_TIME 5
108108

109109
/* DSP should be idle in this time frame */
110110
#define PLATFORM_IDLE_TIME 750000

src/platform/baytrail/include/platform/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct sof;
9494
* the interval of reschedule DMA trace copying in special case like half
9595
* fullness of local DMA trace buffer
9696
*/
97-
#define DMA_TRACE_RESCHEDULE_TIME 5000
97+
#define DMA_TRACE_RESCHEDULE_TIME 5
9898

9999
/* DSP should be idle in this time frame */
100100
#define PLATFORM_IDLE_TIME 750000

src/platform/cannonlake/include/platform/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct sof;
110110
* the interval of reschedule DMA trace copying in special case like half
111111
* fullness of local DMA trace buffer
112112
*/
113-
#define DMA_TRACE_RESCHEDULE_TIME 5000
113+
#define DMA_TRACE_RESCHEDULE_TIME 5
114114

115115
/* DSP should be idle in this time frame */
116116
#define PLATFORM_IDLE_TIME 750000

src/platform/haswell/include/platform/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct sof;
9393
* the interval of reschedule DMA trace copying in special case like half
9494
* fullness of local DMA trace buffer
9595
*/
96-
#define DMA_TRACE_RESCHEDULE_TIME 5000
96+
#define DMA_TRACE_RESCHEDULE_TIME 5
9797

9898
/* DSP should be idle in this time frame */
9999
#define PLATFORM_IDLE_TIME 750000

0 commit comments

Comments
 (0)