From: Frank Li <Frank.li@nxp.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: linux-i3c@lists.infradead.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 1/3] i3c: mipi-i3c-hci: Make bounce buffer code generic to all DMA transfers
Date: Fri, 20 Jun 2025 14:29:50 -0400 [thread overview]
Message-ID: <aFWonk18She5+cdD@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <8a3b32df-b687-47be-ae4b-99008d000542@linux.intel.com>
On Thu, Jun 19, 2025 at 04:37:30PM +0300, Jarkko Nikula wrote:
> Hi
>
> On 6/17/25 6:09 PM, Frank Li wrote:
> > > Thanks, I finially understand the problem you faced. I think other master
> > > controller face similar issue if they use dma. Let me think more. If alloc
> > > buffer size is not align to cache line, swtlib will bounce again.
> > >
> > > rough idea i3c core layer provide an i3c_(un)map_api to do that.
> >
> > struct i3c_dma {
> > void *bounce;
> > dma_addr_t addr;
> > enum dma_data_direction;
> > void *data;
> > size_t data_size;
> > size_t bounce_size;
> > }
> >
> > struct i3c_dma *i3c_dma_map_single(struct device *dev, void *data, size_t sz, enum dma_data_direction dir)
> > {
> > struct i3c_dma *p
> >
> > p = kmalloc(sizeof(*p));
> > if (!p)
> > return p;
> >
> > if (is_vmalloc_addr(data)) {
> > p->bounce = kmalloc(align_up(sz, CACHE_LINE_SIZE)); //avoid swtlib bounce again.
>
> I'll try to look at your idea next week. Do you have pointers to the above
> allocation size rounding is it required?
>
> I've understood from the Documentation/core-api/dma-api-howto.rst
> "Architectures must ensure that kmalloc'ed buffer is DMA-safe" and
> "ARCH_DMA_MINALIGN must be set so that the memory allocator makes sure that
> kmalloc'ed buffer doesn't share a cache line with the others.".
But sz in dma_map_single() will be checked by swtlib, if size is not align
with CACHE_LINE, it will bounce it.
Frank
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2025-06-20 18:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 12:55 [PATCH 1/3] i3c: mipi-i3c-hci: Make bounce buffer code generic to all DMA transfers Jarkko Nikula
2025-06-04 12:55 ` [PATCH 2/3] i3c: mipi-i3c-hci: Use physical device pointer with DMA API Jarkko Nikula
2025-06-04 12:55 ` [PATCH 3/3] i3c: mipi-i3c-hci: Use own DMA bounce buffer management for I2C transfers Jarkko Nikula
2025-06-04 15:00 ` [PATCH 1/3] i3c: mipi-i3c-hci: Make bounce buffer code generic to all DMA transfers Frank Li
2025-06-05 14:07 ` Jarkko Nikula
2025-06-05 15:13 ` Frank Li
2025-06-06 7:16 ` Jarkko Nikula
2025-06-06 15:02 ` Frank Li
2025-06-09 14:15 ` Jarkko Nikula
2025-06-09 15:04 ` Frank Li
2025-06-10 13:42 ` Jarkko Nikula
2025-06-10 17:08 ` Frank Li
2025-06-17 15:09 ` Frank Li
2025-06-19 13:37 ` Jarkko Nikula
2025-06-20 18:29 ` Frank Li [this message]
2025-06-27 14:17 ` Jarkko Nikula
2025-07-31 14:23 ` Jarkko Nikula
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=aFWonk18She5+cdD@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-i3c@lists.infradead.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