Skip to content

Commit a118dfa

Browse files
nxa22042herbertx
authored andcommitted
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: Vakul Garg <[email protected]> Reviewed-by: Horia Geanta <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent e44e77a commit a118dfa

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

drivers/crypto/caam/intern.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ struct caam_drv_private_jr {
5656
u32 inpring_avail; /* Number of free entries in input ring */
5757
int head; /* entinfo (s/w ring) head index */
5858
dma_addr_t *inpring; /* Base of input ring, alloc DMA-safe */
59-
spinlock_t outlock ____cacheline_aligned; /* Output ring index lock */
6059
int out_ring_read_index; /* Output index "tail" */
6160
int tail; /* entinfo (s/w ring) tail index */
6261
struct jr_outentry *outring; /* Base of output ring, DMA-safe */

drivers/crypto/caam/jr.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ static void caam_jr_dequeue(unsigned long devarg)
177177

178178
head = READ_ONCE(jrp->head);
179179

180-
spin_lock(&jrp->outlock);
181-
182180
sw_idx = tail = jrp->tail;
183181
hw_idx = jrp->out_ring_read_index;
184182

@@ -201,7 +199,7 @@ static void caam_jr_dequeue(unsigned long devarg)
201199
/* mark completed, avoid matching on a recycled desc addr */
202200
jrp->entinfo[sw_idx].desc_addr_dma = 0;
203201

204-
/* Stash callback params for use outside of lock */
202+
/* Stash callback params */
205203
usercall = jrp->entinfo[sw_idx].callbk;
206204
userarg = jrp->entinfo[sw_idx].cbkarg;
207205
userdesc = jrp->entinfo[sw_idx].desc_addr_virt;
@@ -234,8 +232,6 @@ static void caam_jr_dequeue(unsigned long devarg)
234232
jrp->tail = tail;
235233
}
236234

237-
spin_unlock(&jrp->outlock);
238-
239235
/* Finally, execute user's callback */
240236
usercall(dev, userdesc, userstatus, userarg);
241237
outring_used--;
@@ -452,7 +448,6 @@ static int caam_jr_init(struct device *dev)
452448
jrp->inpring_avail = JOBR_DEPTH;
453449

454450
spin_lock_init(&jrp->inplock);
455-
spin_lock_init(&jrp->outlock);
456451

457452
/* Select interrupt coalescing parameters */
458453
clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JOBR_INTC |

0 commit comments

Comments
 (0)