-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
audio: host-zephyr: Allocate DMA block configuration on heap #8867
audio: host-zephyr: Allocate DMA block configuration on heap #8867
Conversation
@marc-hb @lgirdwood I think I'm out of the loop here, what is the status of fixing zephyr builds? Are we waiting for some change to be merged into zephyr right? |
This is tracked in #8818 |
src/audio/host-zephyr.c
Outdated
break; | ||
} | ||
|
||
err = dma_config(hd->chan->dma->z_dev, hd->chan->index, dma_cfg); | ||
if (err < 0) { | ||
comp_err(dev, "host_params(): dma_config() failed"); | ||
dma_release_channel(hd->dma->z_dev, hd->chan->index); | ||
rfree(dma_block_cfg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we also want to reset dma_cfg->head_block
to NULL
before freeing? Might be worth making an error handling label at the bottom of the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, should be ok now
Currently, the DMA block configuration (struct dma_block_config) is placed on the stack during host_common_params(). Later on, host_copy_one_shot() tries to re-configure the DMAC driver using the same block configuration that's located in a stack frame that's no longer valid. As such, allocate a DMA block configuration on the heap during host_common_params() which can be used later on (e.g: during host_copy_one_shot()) to reconfigure the DMAC. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2a368ac
to
53bcdbd
Compare
} | ||
|
||
err = dma_get_attribute(hd->dma->z_dev, DMA_ATTR_COPY_ALIGNMENT, | ||
&hd->dma_copy_align); | ||
|
||
if (err < 0) { | ||
comp_err(dev, "host_params(): dma_get_attribute()"); | ||
return err; | ||
goto err_free_block_cfg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually seems to be a bug-fix...
Currently, the DMA block configuration (struct dma_block_config) is placed on the stack during host_common_params(). Later on, host_copy_one_shot() tries to re-configure the DMAC driver using the same block configuration that's located in a stack frame that's no longer valid. As such, allocate a DMA block configuration on the heap during host_common_params() which can be used later on (e.g: during host_copy_one_shot()) to reconfigure the DMAC.
Cherry-picked from #8859