mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Denis Orlov <denorl2009@gmail.com>
To: barebox@lists.infradead.org
Subject: Re: [RFC 1/2] dma: rework dma_sync_single interface
Date: Mon, 6 Mar 2023 16:56:17 +0300	[thread overview]
Message-ID: <CALHb5uhr81Fh3RroNZ-sWH7fry7NNgXa=vCGfrye3k-9VntoqQ@mail.gmail.com> (raw)
In-Reply-To: <20230303100620.GS32097@pengutronix.de>

Hi!

On Fri, 3 Mar 2023 at 13:06, Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> Hi Denis,
>
> On Tue, Feb 28, 2023 at 01:32:47PM +0300, Denis Orlov wrote:
> > -#ifndef dma_sync_single_for_device
> > -static inline void dma_sync_single_for_device(dma_addr_t address, size_t size,
> > -                             enum dma_data_direction dir)
> > +#ifndef arch_sync_dma_for_device
> > +void arch_sync_dma_for_device(void *vaddr, size_t size,
> > +                           enum dma_data_direction dir);
> >  {
> > -     barrier_data((void *)address);
> > +     barrier_data(address);
> >  }
> >  #endif
>
> "static inline" is missing here. Also "address" should be "vaddr".

Ouch, I will be sure to recheck the code before sending v2.

>
> With that fixed imx_v7_defconfig compiles successfully and from what I
> can tell also works.
>
> I haven't looked into this patch yet. Passing a struct device to the
> dma_sync functions is a step into the right direction for sure.

To be short, the gist of the changes corresponds to removing the
discrepancy between
dma_map and dma_sync code that comes from dma_map doing dma/cpu conversions
and dma_sync not doing them. To do this without resorting to code
duplication, carry out
such conversions in common dma_sync functions and call arch-specific
ones for the
syncing part. The common funcs also get a device pointer as the first
argument to be
able to apply this remapping. After the dma/cpu conversion we do get a
virtual address,
so make sure that arch-specific funcs explicitly take pointers as arguments.

>
> Ultimately both patches should be merged to avoid bisecting failures.

Yeah, sure. Was going to do that anyway. I just didn’t want to dump
all of the changes in
one patch while sending this as an RFC.

>
> Sascha
>
>
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                      | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2023-03-06 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 10:32 [RFC 0/2] dma: clean up streaming DMA API Denis Orlov
2023-02-28 10:32 ` [RFC 1/2] dma: rework dma_sync_single interface Denis Orlov
2023-03-03 10:06   ` Sascha Hauer
2023-03-06 13:56     ` Denis Orlov [this message]
2023-02-28 10:32 ` [RFC 2/2] dma: update dma_sync_single uses in drivers Denis Orlov

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='CALHb5uhr81Fh3RroNZ-sWH7fry7NNgXa=vCGfrye3k-9VntoqQ@mail.gmail.com' \
    --to=denorl2009@gmail.com \
    --cc=barebox@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