Skip to content

dw-dma: change dw_dma_stop for byt and cht - #1257

Merged
lgirdwood merged 1 commit into
thesofproject:masterfrom
tlauda:topic/dw-dma-byt-stop
Apr 15, 2019
Merged

lgirdwood merged 1 commit into
thesofproject:masterfrom
tlauda:topic/dw-dma-byt-stop

Conversation

@tlauda

@tlauda tlauda commented Apr 11, 2019

Copy link
Copy Markdown
Contributor

Changes implementation of dw_dma_stop function for
baytrail and cherrytrail platforms. On this platforms
we cannot simply disable channel during transfer,
because it will hang DMA. Previously we were waiting
for transfer finish, which could take up to one period
size (1 ms in most cases). This patch uses suspend and
drain FIFO mechanism, which lowers time needed to stop
DMA channel to steady ~0.34 ms.

Signed-off-by: Tomasz Lauda tomasz.lauda@linux.intel.com

@tlauda
tlauda requested a review from lyakh as a code owner April 11, 2019 12:05
@tlauda

tlauda commented Apr 11, 2019 •

Copy link
Copy Markdown
Contributor Author

@ranj063 @juimonen With this patch ipc timeout on trigger stop is still there. Could you try increasing the timeout for baytrail and cherrytrail and check if it fixes the issue? I think we would need to go from 300 us to 400 us.

Comment thread src/drivers/dw/dma.c Outdated

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.

Do I understand it correctly, that previously this function wasn't disabling the DMA channel actively at all, it was waiting for the enable bit to go to 0, presumably, as triggered by some other process, e.g. by dw_dma_verify_block(), right? But that function only exists if DW_USE_HW_LLI is defined, and it is not defined on BYT and CHT. So, in fact I don't see what would be disabling the channel previously in this function. Does this mean, that this call was always running on a timeout? Were we getting "ewt" errors? The current timeout on BYT is defined to 1333us. Or was that bit cleared in some other way?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Non cAVS platform don't have support for hardware linked list, so linked list items are manually reloaded in function dw_dma_chan_reload_lli and also this function enables the channel again (which is disabled after every lli transfer). So yes, we were just waiting for the transfer to be over with the next DMA irq, which usually took from 0.5 ms to 0.8 ms, but it really depends on when you stop the stream.

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.

Do you know how the channel is disabled after each transfer? Automatically or is there a write to the CHAN_EN register somewhere that I'm not seeing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Automatically.

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.

thanks! Unrelated to this patch, but it would be nice to add a comment explaining that to the driver.

Comment thread src/drivers/dw/dma.c Outdated

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.

not sure we need to OR with .cfg_lo above, but it shouldn't hurt either.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@lyakh This means we need to keep the other bits to the original status as we only changes few bits

@juimonen

Copy link
Copy Markdown

@tlauda what's the issue number, I've never tested/experiences this?

@tlauda

tlauda commented Apr 11, 2019

Copy link
Copy Markdown
Contributor Author

@juimonen You've mentioned it here: #1208 (comment).

@juimonen

Copy link
Copy Markdown

@tlauda aah ok, I've seen this before quite often, but testing couple of days with verbose tracing on it has been quite rare... we should have a separate issue about this, because now we have the 1) topology period count change, 2) the copy_lli change in resume and this mixed up.

Anyway I can test this, takes little bit time as I'm now in nocodec kernel...

@xiulipan

Copy link
Copy Markdown
Contributor

@tlauda @ranj063
Today I check with @xun2z about the IPC timeout issue on BYT.
Please see update in thesofproject/linux#808

Comment thread src/drivers/dw/dma.c Outdated
Comment thread src/drivers/dw/dma.c Outdated

@xiulipan xiulipan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will helps, please give more inline comments.

Comment thread src/drivers/dw/dma.c Outdated
@juimonen

Copy link
Copy Markdown

@tlauda changed PLATFORM_DMA_TIMEOUT to 4000

Was this what you meant? It didn't help the timeout error in stop...

@tlauda

tlauda commented Apr 12, 2019

Copy link
Copy Markdown
Contributor Author

@juimonen No, I meant IPC timeout on kernel side.

Changes implementation of dw_dma_stop function for
baytrail and cherrytrail platforms. On this platforms
we cannot simply disable channel during transfer,
because it will hang DMA. Previously we were waiting
for transfer finish, which could take up to one period
size (1 ms in most cases). This patch uses suspend and
drain FIFO mechanism, which lowers time needed to stop
DMA channel to steady ~0.34 ms.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
@tlauda
tlauda force-pushed the topic/dw-dma-byt-stop branch from 42e19b6 to 9e4832d Compare April 12, 2019 08:55
@juimonen

Copy link
Copy Markdown

@tlauda ipc timeout in kernel side is 300ms... and dmesg also shows time between tx and timeout about 300 ms. Am I missing something here as I see it, kernel is waiting for DSP 300ms without answer...

@tlauda

tlauda commented Apr 12, 2019

Copy link
Copy Markdown
Contributor Author

@juimonen If it's 300 ms, then we have additional problem in kernel with getting responses as @xiulipan stated in thesofproject/linux#808.

@xiulipan

Copy link
Copy Markdown
Contributor

@tlauda @lyakh
I can confirm that it is about 300 ms for the timeout. From the thesofproject/linux#808 you can also find the timeout is about 300 ms.

@lgirdwood
lgirdwood merged commit 5341ca1 into thesofproject:master Apr 15, 2019
@tlauda
tlauda deleted the topic/dw-dma-byt-stop branch November 22, 2019 11:23
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.

5 participants