Skip to content

hda-dma: allocate RUNTIME_SHARED for hda_chan - #4269

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
keyonjie:multi_core
Jun 1, 2021
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
keyonjie:multi_core

Conversation

@keyonjie

@keyonjie keyonjie commented Jun 1, 2021

Copy link
Copy Markdown
Contributor

The DMA channels need to be shared among pipelines and DSP cores,
allocate buffer for it in RUNTIME_SHARED area.

Signed-off-by: Keyon Jie yang.jie@linux.intel.com

The DMA channels need to be shared among pipelines and DSP cores,
allocate buffer for it in RUNTIME_SHARED area.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>

@lyakh lyakh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering: do we know exactly how different cores access the same HDA DMA channel? One possibility is, that if the channel is allocated using rzalloc() on core 0 as a part of initialisation, then core 1 uses it exclusively. It initialises its various fields but then the original memset(0) from rzalloc() on core 0 writes caches back and overwrites core 1 data. If that is the case, maybe just adding one writeback after rzalloc() would be an easier fix?

@keyonjie

keyonjie commented Jun 1, 2021

Copy link
Copy Markdown
Contributor Author

I'm wondering: do we know exactly how different cores access the same HDA DMA channel? One possibility is, that if the channel is allocated using rzalloc() on core 0 as a part of initialisation, then core 1 uses it exclusively. It initialises its various fields but then the original memset(0) from rzalloc() on core 0 writes caches back and overwrites core 1 data. If that is the case, maybe just adding one writeback after rzalloc() would be an easier fix?

These channels is allocated in the first usage of a channel (on core 0, or a secondary core), and different channels can be used for pipelines run on different Cores. These hda_chan structs can be changed at runtime (e.g. change get/put), so allocate in in uncached area is much easier for us.

@lyakh

lyakh commented Jun 1, 2021

Copy link
Copy Markdown
Collaborator

I'm wondering: do we know exactly how different cores access the same HDA DMA channel? One possibility is, that if the channel is allocated using rzalloc() on core 0 as a part of initialisation, then core 1 uses it exclusively. It initialises its various fields but then the original memset(0) from rzalloc() on core 0 writes caches back and overwrites core 1 data. If that is the case, maybe just adding one writeback after rzalloc() would be an easier fix?

These channels is allocated in the first usage of a channel (on core 0, or a secondary core), and different channels can be used for pipelines run on different Cores. These hda_chan structs can be changed at runtime (e.g. change get/put), so allocate in in uncached area is much easier for us.

I think they're allocated in hda_dma_probe() once for all channels and that probably runs on core 0 at init time. Then I suspent that channels are allocated for specific purposes: for audio pipelines, for DMA trace etc. DMA trace is done from a thread, running on core 0. Audio pipelines also run on specific cores. So I actually would expect DMA channels at run time to be only used by the same core? PCMs and DAIs also belong to specific pipelines running on their respective cores. AFAICS DMA channels are also assigned in DAI and host configuration. So, sorry, I'm still not sure how channels can be used by different cores? Maybe we can add a comment somewhere to document this.

@lgirdwood

Copy link
Copy Markdown
Member

CI showing known and unrelated issue.

@lgirdwood
lgirdwood merged commit 9809350 into thesofproject:main Jun 1, 2021
@lgirdwood

Copy link
Copy Markdown
Member

@lyakh I suspect the chan lookup/free probably needs the uncache alias as we may try and use a channel twice. TBC though.

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.

4 participants