diff mbox series

[v2,3/3] crypto: caam/jr - Remove extra memory barrier during job ring enqueue

Message ID 20190315112238.24337-4-vakul.garg@nxp.com (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series CAAM job ring driver cleanups | expand

Commit Message

Vakul Garg March 15, 2019, 11:25 a.m. UTC
In caam_jr_enqueue(), a write barrier is needed to order stores to job
ring slot before declaring addition of new job into input job ring.
The register write is done using wr_reg32() which internally uses
iowrite32() for write operation. The api iowrite32() issues a write
barrier before issuing write operation. Therefore, the wmb() preceding
wr_reg32() can be safely removed.

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
 drivers/crypto/caam/jr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Horia Geanta March 21, 2019, 11:45 a.m. UTC | #1
On 3/15/2019 1:25 PM, Vakul Garg wrote:
> In caam_jr_enqueue(), a write barrier is needed to order stores to job
> ring slot before declaring addition of new job into input job ring.
> The register write is done using wr_reg32() which internally uses
> iowrite32() for write operation. The api iowrite32() issues a write
> barrier before issuing write operation. Therefore, the wmb() preceding
> wr_reg32() can be safely removed.
> 
> Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>

Thanks,
Horia
diff mbox series

Patch

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index e95f82778fa1..1de2562d0982 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -371,9 +371,11 @@  int caam_jr_enqueue(struct device *dev, u32 *desc,
 
 	/*
 	 * Ensure that all job information has been written before
-	 * notifying CAAM that a new job was added to the input ring.
+	 * notifying CAAM that a new job was added to the input ring
+	 * using a memory barrier. The wr_reg32() uses api iowrite32()
+	 * to do the register write. iowrite32() issues a memory barrier
+	 * before the write operation.
 	 */
-	wmb();
 
 	wr_reg32(&jrp->rregs->inpring_jobadd, 1);