aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Poulain <loic.poulain@linaro.org>2020-09-22 16:33:13 +0200
committerLoic Poulain <loic.poulain@linaro.org>2020-11-18 10:03:24 +0100
commit9f4be3adb67d196c122862272acbf407ad972689 (patch)
treee00db5e20b006aa37538eb32a28772c72f1408b7
parent20872d8520b5a894ba4ae0a66c05cc10fe0fa086 (diff)
bus: mhi: Add memory barrier before ringing doorbell
We need to be sure that MHI data structure configuration such has transfer ring element and channel context (wp pointer) have been propagated before ringing the doorbell. Note: Not necessary if doorbell is MMIO (writeX) Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
-rw-r--r--drivers/bus/mhi/core/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
index 4eb93d8bea1d..e11f716c56e7 100644
--- a/drivers/bus/mhi/core/main.c
+++ b/drivers/bus/mhi/core/main.c
@@ -101,6 +101,10 @@ void mhi_ring_cmd_db(struct mhi_controller *mhi_cntrl, struct mhi_cmd *mhi_cmd)
db = ring->iommu_base + (ring->wp - ring->base);
*ring->ctxt_wp = db;
+
+ /* Ensure MHI data structures update before ringing the doorbell. */
+ dma_wmb();
+
mhi_write_db(mhi_cntrl, ring->db_addr, db);
}
@@ -112,6 +116,10 @@ void mhi_ring_chan_db(struct mhi_controller *mhi_cntrl,
db = ring->iommu_base + (ring->wp - ring->base);
*ring->ctxt_wp = db;
+
+ /* Ensure MHI data structures update before ringing the doorbell. */
+ dma_wmb();
+
mhi_chan->db_cfg.process_db(mhi_cntrl, &mhi_chan->db_cfg,
ring->db_addr, db);
}