Commit a118dfa0 authored by Vakul Garg's avatar Vakul Garg Committed by Herbert Xu

crypto: caam/jr - Remove spinlock for output job ring

For each job ring pair, the output ring is processed exactly by one cpu
at a time under a tasklet context (one per ring). Therefore, there is no
need to protect a job ring's access & its private data structure using a
lock. Hence the lock can be removed.
Signed-off-by: default avatarVakul Garg <vakul.garg@nxp.com>
Reviewed-by: default avatarHoria Geanta <horia.geanta@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e44e77ab
...@@ -56,7 +56,6 @@ struct caam_drv_private_jr { ...@@ -56,7 +56,6 @@ struct caam_drv_private_jr {
u32 inpring_avail; /* Number of free entries in input ring */ u32 inpring_avail; /* Number of free entries in input ring */
int head; /* entinfo (s/w ring) head index */ int head; /* entinfo (s/w ring) head index */
dma_addr_t *inpring; /* Base of input ring, alloc DMA-safe */ dma_addr_t *inpring; /* Base of input ring, alloc DMA-safe */
spinlock_t outlock ____cacheline_aligned; /* Output ring index lock */
int out_ring_read_index; /* Output index "tail" */ int out_ring_read_index; /* Output index "tail" */
int tail; /* entinfo (s/w ring) tail index */ int tail; /* entinfo (s/w ring) tail index */
struct jr_outentry *outring; /* Base of output ring, DMA-safe */ struct jr_outentry *outring; /* Base of output ring, DMA-safe */
......
...@@ -177,8 +177,6 @@ static void caam_jr_dequeue(unsigned long devarg) ...@@ -177,8 +177,6 @@ static void caam_jr_dequeue(unsigned long devarg)
head = READ_ONCE(jrp->head); head = READ_ONCE(jrp->head);
spin_lock(&jrp->outlock);
sw_idx = tail = jrp->tail; sw_idx = tail = jrp->tail;
hw_idx = jrp->out_ring_read_index; hw_idx = jrp->out_ring_read_index;
...@@ -201,7 +199,7 @@ static void caam_jr_dequeue(unsigned long devarg) ...@@ -201,7 +199,7 @@ static void caam_jr_dequeue(unsigned long devarg)
/* mark completed, avoid matching on a recycled desc addr */ /* mark completed, avoid matching on a recycled desc addr */
jrp->entinfo[sw_idx].desc_addr_dma = 0; jrp->entinfo[sw_idx].desc_addr_dma = 0;
/* Stash callback params for use outside of lock */ /* Stash callback params */
usercall = jrp->entinfo[sw_idx].callbk; usercall = jrp->entinfo[sw_idx].callbk;
userarg = jrp->entinfo[sw_idx].cbkarg; userarg = jrp->entinfo[sw_idx].cbkarg;
userdesc = jrp->entinfo[sw_idx].desc_addr_virt; userdesc = jrp->entinfo[sw_idx].desc_addr_virt;
...@@ -234,8 +232,6 @@ static void caam_jr_dequeue(unsigned long devarg) ...@@ -234,8 +232,6 @@ static void caam_jr_dequeue(unsigned long devarg)
jrp->tail = tail; jrp->tail = tail;
} }
spin_unlock(&jrp->outlock);
/* Finally, execute user's callback */ /* Finally, execute user's callback */
usercall(dev, userdesc, userstatus, userarg); usercall(dev, userdesc, userstatus, userarg);
outring_used--; outring_used--;
...@@ -452,7 +448,6 @@ static int caam_jr_init(struct device *dev) ...@@ -452,7 +448,6 @@ static int caam_jr_init(struct device *dev)
jrp->inpring_avail = JOBR_DEPTH; jrp->inpring_avail = JOBR_DEPTH;
spin_lock_init(&jrp->inplock); spin_lock_init(&jrp->inplock);
spin_lock_init(&jrp->outlock);
/* Select interrupt coalescing parameters */ /* Select interrupt coalescing parameters */
clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JOBR_INTC | clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JOBR_INTC |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment