ARM: riscpc: fix DMA [Linux 4.4.188]

This Linux kernel change "ARM: riscpc: fix DMA" is included in the Linux 4.4.188 release. This change is authored by Russell King <rmk+kernel [at]> on Thu May 2 17:19:18 2019 +0100. The commit for this change in Linux stable tree is 38d122a (patch) which is from upstream commit ffd9a1b. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream ffd9a1b.

ARM: riscpc: fix DMA

[ Upstream commit ffd9a1ba9fdb7f2bd1d1ad9b9243d34e96756ba2 ]

DMA got broken a while back in two different ways:
1) a change in the behaviour of disable_irq() to wait for the interrupt
   to finish executing causes us to deadlock at the end of DMA.
2) a change to avoid modifying the scatterlist left the first transfer

DMA is only used with expansion cards, so has gone unnoticed.

Fixes: fa4e99899932 ("[ARM] dma: RiscPC: don't modify DMA SG entries")
Signed-off-by: Russell King <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/arm/mach-rpc/dma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c
index 6d3517d..82aac38 100644
--- a/arch/arm/mach-rpc/dma.c
+++ b/arch/arm/mach-rpc/dma.c
@@ -131,7 +131,7 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id)
    } while (1);

    idma->state = ~DMA_ST_AB;
-   disable_irq(irq);
+   disable_irq_nosync(irq);

    return IRQ_HANDLED;
@@ -174,6 +174,9 @@ static void iomd_enable_dma(unsigned int chan, dma_t *dma)
                DMA_FROM_DEVICE : DMA_TO_DEVICE);

+       idma->dma_addr = idma->>dma_address;
+       idma->dma_len = idma->>length;
        iomd_writeb(DMA_CR_C, dma_base + CR);
        idma->state = DMA_ST_AB;

Leave a Reply

Your email address will not be published. Required fields are marked *