Backlog support for CAAM?

From: Richard Weinberger
Date: Wed Jul 24 2019 - 17:22:14 EST


Hi!

Recently I had the pleasure to debug a lockup on a imx6 based platform.
It turned out that the lockup was caused by the CAAM driver because it
just returns -EBUSY upon a full job ring.

Then I found commits:
0618764cb25f ("dm crypt: fix deadlock when async crypto algorithm returns -EBUSY")
c0403ec0bb5a ("Revert "dm crypt: fix deadlock when async crypto algorithm returns -EBUSY"")

Is there a reason why the driver has still no proper backlog support?

If it is just a matter of -ENOPATCH, I have some cycles left an can help.
But before working on this topic I'd like to figure what the current state
or plans are. :-)

So far I work around the issue with disgusting hacks like this one:

--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -339,6 +339,7 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
return -EIO;
}

+again:
spin_lock_bh(&jrp->inplock);

head = jrp->head;
@@ -347,8 +348,8 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
if (!rd_reg32(&jrp->rregs->inpring_avail) ||
CIRC_SPACE(head, tail, JOBR_DEPTH) <= 0) {
spin_unlock_bh(&jrp->inplock);
- dma_unmap_single(dev, desc_dma, desc_size, DMA_TO_DEVICE);
- return -EBUSY;
+ msleep(100);
+ goto again;
}

head_entry = &jrp->entinfo[head];

Thanks,
//richard