Re: [RFC 1/2] dma: rework dma_sync_single interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Fri, 3 Mar 2023 at 13:06, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> 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 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux