Commit 14a8e29cc2012394d3e886b11402eabd49a4d609

Authored by Kim Phillips
Committed by Herbert Xu
1 parent a8ea07c21d

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>

Showing 1 changed file with 2 additions and 6 deletions Side-by-side Diff

drivers/crypto/caam/jr.c
... ... @@ -94,7 +94,8 @@
94 94 userdesc = jrp->entinfo[sw_idx].desc_addr_virt;
95 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 100 jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) &
100 101 (JOBR_DEPTH - 1);
... ... @@ -114,9 +115,6 @@
114 115 jrp->tail = tail;
115 116 }
116 117  
117   - /* set done */
118   - wr_reg32(&jrp->rregs->outring_rmvd, 1);
119   -
120 118 spin_unlock_bh(&jrp->outlock);
121 119  
122 120 /* Finally, execute user's callback */
... ... @@ -264,8 +262,6 @@
264 262 jrp->inp_ring_write_index = (jrp->inp_ring_write_index + 1) &
265 263 (JOBR_DEPTH - 1);
266 264 jrp->head = (head + 1) & (JOBR_DEPTH - 1);
267   -
268   - wmb();
269 265  
270 266 wr_reg32(&jrp->rregs->inpring_jobadd, 1);
271 267