Re: [PATCH v3] crypto: cesa: complete pending requests on device remove

From: Herbert Xu

Date: Fri Oct 02 2026 - 04:10:40 EST


On Sun, Sep 27, 2026 at 02:23:15PM -0700, Rosen Penev wrote:
> mv_cesa_remove() unregisters the algorithms but never drains the engine
> queues, so waiters of requests that were in flight, queued or already
> processed block forever once the device is unbound.
>
> Quiesce the IRQ with disable_irq(), mark the engine aborted so no rearm
> or new submission can restart it, stop it and wait for it to go idle.
> Drain engine->req and engine->queue with -ENODEV, the error
> mv_cesa_queue_req() now returns to new submissions, and report
> engine->complete_queue as successful because ctx->ops->complete() has
> already copied their result out. All of them go through
> mv_cesa_complete_req(), so ctx->ops->cleanup() still releases their DMA
> mappings and descriptors. cesa_dev is cleared last, as those callbacks
> unmap through it.
>
> mv_cesa_dma_cleanup() now stops at dreq->chain.last. mv_cesa_tdma_chain()
> links requests queued back to back and only mv_cesa_tdma_process() severs
> the link, so a request that never ran still points at its successor and
> would otherwise free its tdma_desc_pool and op_pool objects twice.
>
> Assisted-by: LLM
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
> v3: fix more errors
> v2: fix a bunch of sashiko errors
> drivers/crypto/marvell/cesa/cesa.c | 120 ++++++++++++++++++++++++++++-
> drivers/crypto/marvell/cesa/cesa.h | 4 +
> drivers/crypto/marvell/cesa/tdma.c | 9 ++-
> 3 files changed, 131 insertions(+), 2 deletions(-)

Please review

https://sashiko.dev/#/patchset/20260927212315.113966-1-rosenp%40gmail.com

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt