diff options
author | Steve Cornelius <steve.cornelius@freescale.com> | 2012-11-20 16:21:26 -0700 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-11-28 16:57:03 +0800 |
commit | 1e6e7f2b89d84e15a97e4545d98662a60aeec90f (patch) | |
tree | 25c59ced7843a8fbf797cc5fab94029908aeb92e | |
parent | ce7d1e925da7af07109d1ad34a078ad451143b63 (diff) |
ENGR00234401: CAAM: Fix incorrect invalidate call for output ring
The job ring driver exhibited a hang condition in the top of
caam_jr_dequeue() where a BUG_ON statement looks for a condition
where the output ring is said to have valid entries by the ring logic,
but the ring entries apparently have NULL descriptor pointers.
In the initial ARM port of this driver, the cache flush call
of the output ring content occured before the output ring read index
register read occurred, exposing a condition where the driver sensed valid
output entries, yet the entries written by the ring hardware were not
invalidated, and therefore were not visible to the processor, appearing
as false NULL entries.
This patch relocates the invalidate call to immediately follow the
check of the output read index, where it is required.
Signed-off-by: Vicki Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com>
Signed-off-by: Terry Lv <r65388@freescale.com>
-rw-r--r-- | drivers/crypto/caam/jr.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 280aaaa3d4d4..d7394ea58cd6 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -62,9 +62,6 @@ static void caam_jr_dequeue(unsigned long devarg) unsigned long flags; outbusaddr = rd_reg64(&jrp->rregs->outring_base); - dma_sync_single_for_cpu(dev, outbusaddr, - sizeof(struct jr_outentry) * JOBR_DEPTH, - DMA_FROM_DEVICE); spin_lock_irqsave(&jrp->outlock, flags); @@ -75,6 +72,10 @@ static void caam_jr_dequeue(unsigned long devarg) rd_reg32(&jrp->rregs->outring_used)) { hw_idx = jrp->out_ring_read_index; + dma_sync_single_for_cpu(dev, outbusaddr, + sizeof(struct jr_outentry) * JOBR_DEPTH, + DMA_FROM_DEVICE); + for (i = 0; CIRC_CNT(head, tail + i, JOBR_DEPTH) >= 1; i++) { sw_idx = (tail + i) & (JOBR_DEPTH - 1); |