Skip to content

Commit b88630d

Browse files
Jie Haigregkh
authored andcommitted
dmaengine: hisilicon: Fix CQ head update
[ Upstream commit 94477a7 ] After completion of data transfer of one or multiple descriptors, the completion status and the current head pointer to submission queue are written into the CQ and interrupt can be generated to inform the software. In interrupt process CQ is read and cq_head is updated. hisi_dma_irq updates cq_head only when the completion status is success. When an abnormal interrupt reports, cq_head will not update which will cause subsequent interrupt processes read the error CQ and never report the correct status. This patch updates cq_head whenever CQ is accessed. Fixes: e9f08b6 ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai <[email protected]> Acked-by: Zhou Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e84aeea commit b88630d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/dma/hisi_dma.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data)
436436
desc = chan->desc;
437437
cqe = chan->cq + chan->cq_head;
438438
if (desc) {
439+
chan->cq_head = (chan->cq_head + 1) % hdma_dev->chan_depth;
440+
hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR,
441+
chan->qp_num, chan->cq_head);
439442
if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) {
440-
chan->cq_head = (chan->cq_head + 1) %
441-
hdma_dev->chan_depth;
442-
hisi_dma_chan_write(hdma_dev->base,
443-
HISI_DMA_CQ_HEAD_PTR, chan->qp_num,
444-
chan->cq_head);
445443
vchan_cookie_complete(&desc->vd);
446444
} else {
447445
dev_err(&hdma_dev->pdev->dev, "task error!\n");

0 commit comments

Comments
 (0)