All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] bus: mhi: Ensure correct ring update ordering with memory barrier
@ 2020-11-26 15:06 Loic Poulain
  2020-11-27 17:32 ` Jeffrey Hugo
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Loic Poulain @ 2020-11-26 15:06 UTC (permalink / raw)
  To: manivannan.sadhasivam, hemantk; +Cc: linux-arm-msm, jhugo, Loic Poulain

The ring element data, though being part of coherent memory, still need
to be performed before updating the ring context to point to this new
element. That can be guaranteed with a memory barrier (dma_wmb).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 v2: fix comment style

 drivers/bus/mhi/core/main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
index 67188ea..ea39df0 100644
--- a/drivers/bus/mhi/core/main.c
+++ b/drivers/bus/mhi/core/main.c
@@ -111,7 +111,14 @@ void mhi_ring_chan_db(struct mhi_controller *mhi_cntrl,
 	dma_addr_t db;
 
 	db = ring->iommu_base + (ring->wp - ring->base);
+
+	/*
+	 * Writes to the new ring element must be visible to the hardware
+	 * before letting h/w know there is new element to fetch.
+	 */
+	dma_wmb();
 	*ring->ctxt_wp = db;
+
 	mhi_chan->db_cfg.process_db(mhi_cntrl, &mhi_chan->db_cfg,
 				    ring->db_addr, db);
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-01 20:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 15:06 [PATCH v2] bus: mhi: Ensure correct ring update ordering with memory barrier Loic Poulain
2020-11-27 17:32 ` Jeffrey Hugo
2020-11-28  6:03 ` Manivannan Sadhasivam
2020-11-30  8:18   ` Loic Poulain
2020-11-30 15:18     ` Jeffrey Hugo
2020-11-30 15:13   ` Jeffrey Hugo
2021-01-06 13:09 ` Manivannan Sadhasivam
2021-01-06 13:11 ` Manivannan Sadhasivam
2021-03-01 19:59 ` patchwork-bot+linux-arm-msm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.