Skip to content

Conversation

@LaurentiuM1234
Copy link
Contributor

@LaurentiuM1234 LaurentiuM1234 commented Feb 15, 2024

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

@dbaluta
Copy link
Collaborator

dbaluta commented Feb 15, 2024

@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?

@marc-hb
Copy link
Collaborator

marc-hb commented Feb 15, 2024

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

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);
Copy link
Collaborator

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

Copy link
Contributor Author

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>
if (err < 0) {
comp_err(dev, "host_params(): dma_get_attribute()");
return err;
goto err_free_block_cfg;
Copy link
Collaborator

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...

@dbaluta dbaluta merged commit 3681e09 into thesofproject:main Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants