Re: [PATCH] crypto: marvell/cesa - Avoid empty transfer descriptor

Corentin Labbe
2025-05-21T13:58:51Z

Le Wed, May 21, 2025 at 06:56:12PM +0800, Herbert Xu a écrit :
> On Wed, May 21, 2025 at 12:45:18PM +0200, Corentin Labbe wrote:
> >
> > It fails to build with:
> > ERROR: modpost: "arch_sync_dma_for_device" [drivers/crypto/marvell/cesa/marvell-cesa.ko] undefined!
>
> OK, what about this patch?
>
> Thanks,
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> --
> diff --git a/drivers/crypto/marvell/cesa/hash.c b/drivers/crypto/marvell/cesa/hash.c
> index 6815eddc9068..5c46cd267789 100644
> --- a/drivers/crypto/marvell/cesa/hash.c
> +++ b/drivers/crypto/marvell/cesa/hash.c
> @@ -49,8 +49,7 @@ mv_cesa_ahash_req_iter_next_op(struct mv_cesa_ahash_dma_iter *iter)
> static inline int
> mv_cesa_ahash_dma_alloc_cache(struct mv_cesa_ahash_dma_req *req, gfp_t flags)
> {
> - req->cache = dma_pool_alloc(cesa_dev->dma->cache_pool, flags,
> - &req->cache_dma);
> + req->cache = kmalloc(CESA_MAX_HASH_BLOCK_SIZE, flags);
> if (!req->cache)
> return -ENOMEM;
>
> @@ -63,8 +62,8 @@ mv_cesa_ahash_dma_free_cache(struct mv_cesa_ahash_dma_req *req)
> if (!req->cache)
> return;
>
> - dma_pool_free(cesa_dev->dma->cache_pool, req->cache,
> - req->cache_dma);
> + dma_unmap_single(cesa_dev->dev, req->cache_dma, CESA_MAX_HASH_BLOCK_SIZE, DMA_TO_DEVICE);
> + kfree(req->cache);
> }
>
> static int mv_cesa_ahash_dma_alloc_padding(struct mv_cesa_ahash_dma_req *req,
> @@ -533,6 +532,13 @@ mv_cesa_ahash_dma_add_cache(struct mv_cesa_tdma_chain *chain,
>
> memcpy(ahashdreq->cache, creq->cache, creq->cache_ptr);
>
> + ahashdreq->cache_dma = dma_map_single(cesa_dev->dev, ahashdreq->cache, CESA_MAX_HASH_BLOCK_SIZE, DMA_TO_DEVICE);
> + if (dma_mapping_error(cesa_dev->dev, ahashdreq->cache_dma)) {
> + dev_err(cesa_dev->dev, "dma_map_single failed\n");
> + kfree(ahashdreq->cache);
> + return -ENOMEM;
> + }
> +
> return mv_cesa_dma_add_data_transfer(chain,
> CESA_SA_DATA_SRAM_OFFSET,
> ahashdreq->cache_dma,

Hello

It still fail:
http://kernel.montjoie.ovh/479319.log

but I have still all old patch of you stacked, perhaps could you do a branch somewhere to be sure ?
current state is: http://kernel.montjoie.ovh/cesa.diff

Regards