Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kim Phillips and committed by
Herbert Xu
14a8e29c a8ea07c2

+2 -6
+2 -6
drivers/crypto/caam/jr.c
··· 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 113 115 114 jrp->tail = tail; 116 115 } 117 - 118 - /* set done */ 119 - wr_reg32(&jrp->rregs->outring_rmvd, 1); 120 116 121 117 spin_unlock_bh(&jrp->outlock); 122 118 ··· 262 264 jrp->inp_ring_write_index = (jrp->inp_ring_write_index + 1) & 263 265 (JOBR_DEPTH - 1); 264 266 jrp->head = (head + 1) & (JOBR_DEPTH - 1); 265 - 266 - wmb(); 267 267 268 268 wr_reg32(&jrp->rregs->inpring_jobadd, 1); 269 269