mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Cc: Corentin Labbe <clabbe.montjoie@gmail.com>,
	jernej.skrabec@gmail.com, samuel@sholland.org, wens@csie.org,
	linux-arm-kernel@lists.infradead.org,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-sunxi@lists.linux.dev
Subject: Re: [PATCH RESEND] crypto: sun8i-ss: do not use sg_dma_len before calling DMA functions
Date: Mon, 28 Apr 2025 11:08:49 +0800	[thread overview]
Message-ID: <aA7xQbuV2oOU1oFq@gondor.apana.org.au> (raw)
In-Reply-To: <e147c220-92e1-40cb-920b-916cf6703b40@gmail.com>

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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2025-04-28  3:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-27 11:12 Corentin Labbe
2025-04-27 18:23 ` Ovidiu Panait
2025-04-28  3:08   ` Herbert Xu [this message]
2025-04-28 11:54 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aA7xQbuV2oOU1oFq@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=clabbe.montjoie@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=ovidiu.panait.oss@gmail.com \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®