Skip to content

Commit 1c2e881

Browse files
Lee Nipperherbertx
authored andcommitted
crypto: talitos - Implement done interrupt mitigation
In talitos_interrupt, upon one done interrupt, mask further done interrupts, and ack only any error interrupt. In talitos_done, unmask done interrupts after completing processing. In flush_channel, ack each done channel processed. Keep done overflow interrupts masked because even though each pkt is ack'ed, a few done overflows still occur. Signed-off-by: Lee Nipper <lee.nipper@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 40405f1 commit 1c2e881

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

‎drivers/crypto/talitos.c‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,11 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch)
319319

320320
/* descriptors with their done bits set don't get the error */
321321
rmb();
322-
if ((request->desc->hdr & DESC_HDR_DONE) == DESC_HDR_DONE)
322+
if ((request->desc->hdr & DESC_HDR_DONE) == DESC_HDR_DONE) {
323323
status = 0;
324-
else
324+
/* Ack each pkt completed on channel */
325+
out_be32(priv->reg + TALITOS_ICR, (1 << (ch * 2)));
326+
} else
325327
if (!error)
326328
break;
327329
else
@@ -369,6 +371,11 @@ static void talitos_done(unsigned long data)
369371

370372
for (ch = 0; ch < priv->num_channels; ch++)
371373
flush_channel(dev, ch, 0, 0);
374+
375+
/* At this point, all completed channels have been processed.
376+
* Unmask done interrupts for channels completed later on.
377+
*/
378+
setbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_DONE);
372379
}
373380

374381
/*
@@ -557,15 +564,22 @@ static irqreturn_t talitos_interrupt(int irq, void *data)
557564
isr = in_be32(priv->reg + TALITOS_ISR);
558565
isr_lo = in_be32(priv->reg + TALITOS_ISR_LO);
559566

560-
/* ack */
561-
out_be32(priv->reg + TALITOS_ICR, isr);
562-
out_be32(priv->reg + TALITOS_ICR_LO, isr_lo);
567+
if (unlikely((isr & ~TALITOS_ISR_CHDONE) || isr_lo)) {
568+
/*
569+
* Acknowledge error interrupts here.
570+
* Done interrupts are ack'ed as part of done_task.
571+
*/
572+
out_be32(priv->reg + TALITOS_ICR, isr);
573+
out_be32(priv->reg + TALITOS_ICR_LO, isr_lo);
563574

564-
if (unlikely((isr & ~TALITOS_ISR_CHDONE) || isr_lo))
565575
talitos_error((unsigned long)data, isr, isr_lo);
566-
else
567-
if (likely(isr & TALITOS_ISR_CHDONE))
576+
} else
577+
if (likely(isr & TALITOS_ISR_CHDONE)) {
578+
/* mask further done interrupts. */
579+
clrbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_DONE);
580+
/* done_task will unmask done interrupts at exit */
568581
tasklet_schedule(&priv->done_task);
582+
}
569583

570584
return (isr || isr_lo) ? IRQ_HANDLED : IRQ_NONE;
571585
}

‎drivers/crypto/talitos.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
#define TALITOS_MCR_LO 0x1038
3838
#define TALITOS_MCR_SWR 0x1 /* s/w reset */
3939
#define TALITOS_IMR 0x1008 /* interrupt mask register */
40-
#define TALITOS_IMR_INIT 0x10fff /* enable channel IRQs */
40+
#define TALITOS_IMR_INIT 0x100ff /* enable channel IRQs */
41+
#define TALITOS_IMR_DONE 0x00055 /* done IRQs */
4142
#define TALITOS_IMR_LO 0x100C
4243
#define TALITOS_IMR_LO_INIT 0x20000 /* allow RNGU error IRQs */
4344
#define TALITOS_ISR 0x1010 /* interrupt status register */

0 commit comments

Comments
 (0)