aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorKim Phillips <kim.phillips@freescale.com>2012-06-22 20:48:56 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-06-27 02:42:07 -0400
commit14a8e29cc2012394d3e886b11402eabd49a4d609 (patch)
tree9852a7f7c4674b1331c7e2f87a47d5119600a0a9 /drivers/crypto
parenta8ea07c21d40cf17dd9cbe3cbf87d477b26c354f (diff)
crypto: caam - consolidate memory barriers from job ring en/dequeue
Memory barriers are implied by the i/o register write implementation (at least on Power). So we can remove the redundant wmb() in caam_jr_enqueue, and, in dequeue(), hoist the h/w done notification write up to before we need to increment the head of the ring, and save an smp_mb. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/caam/jr.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 7ae5e51a0597..0adaad1b8cf7 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -94,7 +94,8 @@ static void caam_jr_dequeue(unsigned long devarg)
94 userdesc = jrp->entinfo[sw_idx].desc_addr_virt; 94 userdesc = jrp->entinfo[sw_idx].desc_addr_virt;
95 userstatus = jrp->outring[hw_idx].jrstatus; 95 userstatus = jrp->outring[hw_idx].jrstatus;
96 96
97 smp_mb(); 97 /* set done */
98 wr_reg32(&jrp->rregs->outring_rmvd, 1);
98 99
99 jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) & 100 jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) &
100 (JOBR_DEPTH - 1); 101 (JOBR_DEPTH - 1);
@@ -114,9 +115,6 @@ static void caam_jr_dequeue(unsigned long devarg)
114 jrp->tail = tail; 115 jrp->tail = tail;
115 } 116 }
116 117
117 /* set done */
118 wr_reg32(&jrp->rregs->outring_rmvd, 1);
119
120 spin_unlock_bh(&jrp->outlock); 118 spin_unlock_bh(&jrp->outlock);
121 119
122 /* Finally, execute user's callback */ 120 /* Finally, execute user's callback */
@@ -265,8 +263,6 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
265 (JOBR_DEPTH - 1); 263 (JOBR_DEPTH - 1);
266 jrp->head = (head + 1) & (JOBR_DEPTH - 1); 264 jrp->head = (head + 1) & (JOBR_DEPTH - 1);
267 265
268 wmb();
269
270 wr_reg32(&jrp->rregs->inpring_jobadd, 1); 266 wr_reg32(&jrp->rregs->inpring_jobadd, 1);
271 267
272 spin_unlock(&jrp->inplock); 268 spin_unlock(&jrp->inplock);