[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aA7xQbuV2oOU1oFq@gondor.apana.org.au>
Date: Mon, 28 Apr 2025 11:08:49 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Ovidiu Panait <ovidiu.panait.oss@...il.com>
Cc: Corentin Labbe <clabbe.montjoie@...il.com>, jernej.skrabec@...il.com,
samuel@...lland.org, wens@...e.org,
linux-arm-kernel@...ts.infradead.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH RESEND] crypto: sun8i-ss: do not use sg_dma_len before
calling DMA functions
On Sun, Apr 27, 2025 at 09:23:40PM +0300, Ovidiu Panait wrote:
>
> On the other hand, multi_v7_defconfig has CONFIG_NEED_SG_DMA_LENGTH
> enabled, so sg_dma_len(sg) defaults to sg->dma_length and it would need
> to be used after calling dma_map_sg() (as indicated in the comment from
> include/linux/scatterlist.h).
In general, only use sg_dma_len if you are mapping an entire
SG list with dma_map_sg.
If you're using dma_map_single, do not use sg_dma_len.
This is because dma_map_sg will try to merge entries together,
thus creating an sg_dma_len that is bigger than the original
(and reducing the SG list length accordingly).
OTOH dma_map_single can't possibly do that.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists