mirror of https://github.com/thesofproject/sof.git
dma-trace: Align DMA buffer correctly to fix dma tracing issues
Force DMA buffer to be correctly aligned. If the buffer is only 64-byte aligned, when using hda-dma, then the last 64-bytes of the DMA buffer is not transferred correctly to host side. Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
This commit is contained in:
parent
9983ab67a9
commit
c11562b00a
|
@ -223,10 +223,23 @@ static int dma_trace_buffer_init(struct dma_trace_data *d)
|
||||||
struct dma_trace_buf *buffer = &d->dmatb;
|
struct dma_trace_buf *buffer = &d->dmatb;
|
||||||
void *buf;
|
void *buf;
|
||||||
k_spinlock_key_t key;
|
k_spinlock_key_t key;
|
||||||
|
uint32_t addr_align;
|
||||||
|
int err;
|
||||||
|
|
||||||
/* allocate new buffer */
|
if (!d || !d->dc.dmac) {
|
||||||
buf = rballoc(0, SOF_MEM_CAPS_RAM | SOF_MEM_CAPS_DMA,
|
mtrace_printf(LOG_LEVEL_ERROR,
|
||||||
DMA_TRACE_LOCAL_SIZE);
|
"%s failed: no DMAC!", __func__);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = dma_get_attribute(d->dc.dmac, DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT,
|
||||||
|
&addr_align);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
/* For DMA to work properly the buffer must be correctly aligned */
|
||||||
|
buf = rballoc_align(0, SOF_MEM_CAPS_RAM | SOF_MEM_CAPS_DMA,
|
||||||
|
DMA_TRACE_LOCAL_SIZE, addr_align);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
tr_err(&dt_tr, "dma_trace_buffer_init(): alloc failed");
|
tr_err(&dt_tr, "dma_trace_buffer_init(): alloc failed");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
Loading…
Reference in New Issue