mmc: cmdq_hci: Add a memory barrier before ringing doorbell
Ensure the task descriptor list memory is flushed before ringing
the doorbell by adding a memory barrier. Also commit the doorbell
write immediately to help improve performance.
Change-Id: I321d5bed95b802d4bcc00836ce9cdede316b29f5
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
diff --git a/drivers/mmc/host/cmdq_hci.c b/drivers/mmc/host/cmdq_hci.c
index ebc6001..6a0a6b0b 100644
--- a/drivers/mmc/host/cmdq_hci.c
+++ b/drivers/mmc/host/cmdq_hci.c
@@ -614,8 +614,9 @@
cq_host->mrq_slot[DCMD_SLOT] = mrq;
if (cq_host->ops->pm_qos_update)
cq_host->ops->pm_qos_update(mmc, NULL, true);
- cmdq_writel(cq_host, 1 << DCMD_SLOT, CQTDBR);
- return 0;
+ /* DCMD's are always issued on a fixed slot */
+ tag = DCMD_SLOT;
+ goto ring_doorbell;
}
if (cq_host->ops->crypto_cfg) {
@@ -649,7 +650,12 @@
if (cq_host->ops->set_tranfer_params)
cq_host->ops->set_tranfer_params(mmc);
+ring_doorbell:
+ /* Ensure the task descriptor list is flushed before ringing doorbell */
+ wmb();
cmdq_writel(cq_host, 1 << tag, CQTDBR);
+ /* Commit the doorbell write immediately */
+ wmb();
out:
return err;