]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: sun8i-ce - remove channel timeout field
authorOvidiu Panait <ovidiu.panait.oss@gmail.com>
Tue, 2 Sep 2025 13:21:26 +0000 (16:21 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:34:23 +0000 (15:34 -0500)
[ Upstream commit 9a23ea1f7558bdd3f8d2b35b1c2e16a2f9bf671e ]

Using the number of bytes in the request as DMA timeout is really
inconsistent, as large requests could possibly set a timeout of
hundreds of seconds.

Remove the per-channel timeout field and use a single, static DMA
timeout of 3 seconds for all requests.

Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Tested-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Reviewed-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-trng.c
drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h

index 63e66a85477e542e135b7e01eff16fa8bace3cdd..d0ba2b2fb21614c3bccfc6ceaf6e764fe98c29f7 100644 (file)
@@ -264,7 +264,6 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req
                goto theend_sgs;
        }
 
-       chan->timeout = areq->cryptlen;
        rctx->nr_sgs = ns;
        rctx->nr_sgd = nd;
        return 0;
index fcc6832a065cbb2f1388f0e0d8348ecfad1d4521..61ae072e21d4cec28ace0e7e4129c60e40a31130 100644 (file)
@@ -210,11 +210,10 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
        mutex_unlock(&ce->mlock);
 
        wait_for_completion_interruptible_timeout(&ce->chanlist[flow].complete,
-                       msecs_to_jiffies(ce->chanlist[flow].timeout));
+                       msecs_to_jiffies(CE_DMA_TIMEOUT_MS));
 
        if (ce->chanlist[flow].status == 0) {
-               dev_err(ce->dev, "DMA timeout for %s (tm=%d) on flow %d\n", name,
-                       ce->chanlist[flow].timeout, flow);
+               dev_err(ce->dev, "DMA timeout for %s on flow %d\n", name, flow);
                err = -EFAULT;
        }
        /* No need to lock for this read, the channel is locked so
index 3f9d79ea01aaa671cfd41214fd8d16278df96955..b428497b72a32005e86ee2e4666b4c57f428e85d 100644 (file)
@@ -457,8 +457,6 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq)
        else
                cet->t_dlen = cpu_to_le32(areq->nbytes / 4 + j);
 
-       chan->timeout = areq->nbytes;
-
        err = sun8i_ce_run_task(ce, flow, crypto_ahash_alg_name(tfm));
 
        dma_unmap_single(ce->dev, addr_pad, j * 4, DMA_TO_DEVICE);
index 762459867b6c55c245f196bf256d4039d1a6ecb1..d0a1ac66738bfb48e9d42d35ca1366e6337ec278 100644 (file)
@@ -137,7 +137,6 @@ int sun8i_ce_prng_generate(struct crypto_rng *tfm, const u8 *src,
 
        cet->t_dst[0].addr = desc_addr_val_le32(ce, dma_dst);
        cet->t_dst[0].len = cpu_to_le32(todo / 4);
-       ce->chanlist[flow].timeout = 2000;
 
        err = sun8i_ce_run_task(ce, 3, "PRNG");
        mutex_unlock(&ce->rnglock);
index e1e8bc15202e0381a238f2d1f449f887cf10b5d0..244529bf06162275f53a858869a0c380a47fb102 100644 (file)
@@ -79,7 +79,6 @@ static int sun8i_ce_trng_read(struct hwrng *rng, void *data, size_t max, bool wa
 
        cet->t_dst[0].addr = desc_addr_val_le32(ce, dma_dst);
        cet->t_dst[0].len = cpu_to_le32(todo / 4);
-       ce->chanlist[flow].timeout = todo;
 
        err = sun8i_ce_run_task(ce, 3, "TRNG");
        mutex_unlock(&ce->rnglock);
index 83df4d71905318100f184cee0ef52bbb9e09e5ea..4afca65d3355c3d866fae812755ac9f94ae2556b 100644 (file)
 #define MAX_SG 8
 
 #define CE_MAX_CLOCKS 4
+#define CE_DMA_TIMEOUT_MS      3000
 
 #define MAXFLOW 4
 
@@ -196,7 +197,6 @@ struct sun8i_ce_flow {
        struct completion complete;
        int status;
        dma_addr_t t_phy;
-       int timeout;
        struct ce_task *tl;
        void *backup_iv;
        void *bounce_iv;