On 29-01-20, 17:19, Fabio Estevam wrote:
Hi Martin,
Thanks for the fix.
On Wed, Jan 29, 2020 at 10:41 AM Martin Fuzzey martin.fuzzey@flowbird.group wrote:
There is a DMA problem with the serial ports on i.MX6.
When the following sequence is performed:
- Open a port
- Write some data
- Close the port
- Open a *different* port
- Write some data
- Close the port
The second write sends nothing and the second close hangs. If the first close() is omitted it works.
Adding logs to the the UART driver shows that the DMA is being setup but the callback is never invoked for the second write.
This used to work in 4.19.
Git bisect leads to: ad0d92d: "dmaengine: imx-sdma: refine to load context only once"
This commit adds a "context_loaded" flag used to avoid unnecessary context setups. However the flag is only reset in sdma_channel_terminate_work(), which is only invoked in a worker triggered by sdma_terminate_all() IF there is an active descriptor.
So, if no active descriptor remains when the channel is terminated, the flag is not reset and, when the channel is later reused the old context is used.
Fix the problem by always resetting the flag in sdma_free_chan_resources().
Fixes: ad0d92d: "dmaengine: imx-sdma: refine to load context only once"
Nit: in the Fixes tag we use 12 digits for the commit ID and the Subject is enclosed by parenthesis.
The preferred format would be:
Fixes: ad0d92d7ba6a ("dmaengine: imx-sdma: refine to load context only once")
Reviewed-by: Fabio Estevam festevam@gmail.com
Applied, with updated Fixes line. Thanks