crypto: caam/jr - Remove extra memory barrier during job ring dequeue
authorVakul Garg <vakul.garg@nxp.com>
Tue, 9 Apr 2019 06:38:08 +0000 (06:38 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 18 Apr 2019 14:14:58 +0000 (22:14 +0800)
In function caam_jr_dequeue(), a full memory barrier is used before
writing response job ring's register to signal removal of the completed
job. Therefore for writing the register, we do not need another write
memory barrier. Hence it is removed by replacing the call to wr_reg32()
with a newly defined function wr_reg32_relaxed().

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/jr.c
drivers/crypto/caam/regs.h

index 1de2562d09824960582472d1a333e15842bc82e0..044a69b526f7ba402dde4901518dbf85f6f416d6 100644 (file)
@@ -213,7 +213,7 @@ static void caam_jr_dequeue(unsigned long devarg)
                mb();
 
                /* set done */
-               wr_reg32(&jrp->rregs->outring_rmvd, 1);
+               wr_reg32_relaxed(&jrp->rregs->outring_rmvd, 1);
 
                jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) &
                                           (JOBR_DEPTH - 1);
index 3cd0822ea819966abf8bc4a37e07ee242c41552a..9e912c722e33aa3ed8fcc08f093bfcaba117c6c0 100644 (file)
@@ -96,6 +96,14 @@ cpu_to_caam(16)
 cpu_to_caam(32)
 cpu_to_caam(64)
 
+static inline void wr_reg32_relaxed(void __iomem *reg, u32 data)
+{
+       if (caam_little_end)
+               writel_relaxed(data, reg);
+       else
+               writel_relaxed(cpu_to_be32(data), reg);
+}
+
 static inline void wr_reg32(void __iomem *reg, u32 data)
 {
        if (caam_little_end)