dmaengine: idxd: Protect int_handle field in hw descriptor
authorGuanjun <guanjun@linux.alibaba.com>
Mon, 11 Dec 2023 05:37:03 +0000 (13:37 +0800)
committerVinod Koul <vkoul@kernel.org>
Mon, 11 Dec 2023 06:22:16 +0000 (11:52 +0530)
The int_handle field in hw descriptor should also be protected
by wmb() before possibly triggering a DMA read.

Fixes: eb0cf33a91b4 (dmaengine: idxd: move interrupt handle assignment)
Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Lijun Pan <lijun.pan@intel.com>
Link: https://lore.kernel.org/r/20231211053704.2725417-2-guanjun@linux.alibaba.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/idxd/submit.c

index c01db23e3333f70316ea1bfbca99930fabfdc1cf..3f922518e3a525f22b49c56ae655a670c63aa10e 100644 (file)
@@ -182,13 +182,6 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
 
        portal = idxd_wq_portal_addr(wq);
 
-       /*
-        * The wmb() flushes writes to coherent DMA data before
-        * possibly triggering a DMA read. The wmb() is necessary
-        * even on UP because the recipient is a device.
-        */
-       wmb();
-
        /*
         * Pending the descriptor to the lockless list for the irq_entry
         * that we designated the descriptor to.
@@ -199,6 +192,13 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
                llist_add(&desc->llnode, &ie->pending_llist);
        }
 
+       /*
+        * The wmb() flushes writes to coherent DMA data before
+        * possibly triggering a DMA read. The wmb() is necessary
+        * even on UP because the recipient is a device.
+        */
+       wmb();
+
        if (wq_dedicated(wq)) {
                iosubmit_cmds512(portal, desc->hw, 1);
        } else {