diff options
author | Iuliana Prodan <iuliana.prodan@nxp.com> | 2020-02-17 03:05:10 +0200 |
---|---|---|
committer | Horia Geantă <horia.geanta@nxp.com> | 2020-02-24 11:19:13 +0200 |
commit | 5ae5b1903d4135f69e1e8b805d5872af0cd76176 (patch) | |
tree | 3c11a06898330dc1b64221a14f69ec8278672eae | |
parent | e4b7f6538df9266d9ab71f4bd6a5bc75df6c2cde (diff) |
LF-838: crypto: caam - increase the domain of write memory barrier to full system
In caam_jr_enqueue, under heavy DDR load, smp_wmb() or dma_wmb()
fail to make the input ring be updated before the CAAM starts
reading it. So, CAAM will process, again, an old descriptor address
and will put it in the output ring. This will make caam_jr_dequeue()
to fail, since this old descriptor is not in the software ring.
To fix this, use wmb() which works on the full system instead of
inner/outer shareable domains.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
(cherry picked from commit e4978516eeacb083412753dbc523de7d9dca8463)
It looks like this also fixes MLK-23259, so cherry-pick
from LF linux-lts-nxp:lf-5.4.y into linux-imx:imx_4.14.y.
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
-rw-r--r-- | drivers/crypto/caam/jr.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 15371c3d5efa..aca752562821 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -452,8 +452,16 @@ int caam_jr_enqueue(struct device *dev, u32 *desc, * Guarantee that the descriptor's DMA address has been written to * the next slot in the ring before the write index is updated, since * other cores may update this index independently. + * + * Under heavy DDR load, smp_wmb() or dma_wmb() fail to make the input + * ring be updated before the CAAM starts reading it. So, CAAM will + * process, again, an old descriptor address and will put it in the + * output ring. This will make caam_jr_dequeue() to fail, since this + * old descriptor is not in the software ring. + * To fix this, use wmb() which works on the full system instead of + * inner/outer shareable domains. */ - smp_wmb(); + wmb(); jrp->inp_ring_write_index = (jrp->inp_ring_write_index + 1) & (JOBR_DEPTH - 1); |