From 51dea36500dce7c62beb035f43b57369e0a345f0 Mon Sep 17 00:00:00 2001 From: zhangtianyang Date: Sun, 27 Apr 2025 15:15:57 +0800 Subject: [PATCH 1/2] megaraid: loongarch: Add udelay to avoid data error caused by dma sequence Upstream: no Conflict: none Checkpatch: pass There is no guarantee of sequence between DMA and interrupts on the Loongson platform. Signed-off-by: songwenge Signed-off-by: zhangtianyang Signed-off-by: Ming Wang --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 5ebcb582cf0c..2a820ed04c1e 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -3876,7 +3876,13 @@ static irqreturn_t megasas_isr_fusion(int irq, void *devp) instance->instancet->clear_intr(instance); return IRQ_HANDLED; } - +#ifdef CONFIG_LOONGARCH + /* + * There is no guarantee of sequence between DMA + * and interrupts on the Loongson platform. + */ + udelay(30); +#endif return complete_cmd_fusion(instance, irq_context->MSIxIndex, irq_context) ? IRQ_HANDLED : IRQ_NONE; } -- Gitee From 09f3da5caf578dfc72aeea904886330c9b6fa81d Mon Sep 17 00:00:00 2001 From: Ming Wang Date: Tue, 13 May 2025 15:21:02 +0800 Subject: [PATCH 2/2] nvme: loongarch: Add udelay to avoid data error caused by dma sequence Upstream: no Conflict: none Checkpatch: pass There is no guarantee of sequence between DMA and interrupts on the Loongson platform. Signed-off-by: Ming Wang --- drivers/nvme/host/pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 383901027313..e2b0b47f66b9 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -10,6 +10,9 @@ #include #include #include +#ifdef CONFIG_LOONGARCH +#include +#endif #include #include #include @@ -1079,6 +1082,11 @@ static irqreturn_t nvme_irq(int irq, void *data) struct nvme_queue *nvmeq = data; DEFINE_IO_COMP_BATCH(iob); +#ifdef CONFIG_LOONGARCH + /* Ensure that the data is completely in place */ + udelay(30); +#endif + if (nvme_poll_cq(nvmeq, &iob)) { if (!rq_list_empty(iob.req_list)) nvme_pci_complete_batch(&iob); -- Gitee