mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 09/12] ARM: mmu: Share code for dma_sync_single_for_cpu()
Date: Thu, 17 Jan 2019 13:50:31 -0800	[thread overview]
Message-ID: <CAHQ1cqGG1GiXh-1yz_cG4DjGgfKi1Un+Yw4Xd7a6EZ76R-Bt4Q@mail.gmail.com> (raw)
In-Reply-To: <20190117212847.GB4532@ravnborg.org>

On Thu, Jan 17, 2019 at 1:28 PM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Andrey.
>
> On Wed, Jan 16, 2019 at 10:38:37PM -0800, Andrey Smirnov wrote:
> > Both ARM and ARM64 have identical code for
> > dma_sync_single_for_cpu(). Move it to mmu-common.c so it can be shared.
> >
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
> >  arch/arm/cpu/mmu-common.c | 8 ++++++++
> >  arch/arm/cpu/mmu.c        | 7 -------
> >  arch/arm/cpu/mmu_64.c     | 7 -------
> >  3 files changed, 8 insertions(+), 14 deletions(-)
> >
> > diff --git a/arch/arm/cpu/mmu-common.c b/arch/arm/cpu/mmu-common.c
> > index 8c7d61447..a7d3b5b11 100644
> > --- a/arch/arm/cpu/mmu-common.c
> > +++ b/arch/arm/cpu/mmu-common.c
> > @@ -8,6 +8,14 @@
> >
> >  #include "mmu.h"
> >
> > +
> > +void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
> > +                          enum dma_data_direction dir)
> > +{
> > +     if (dir != DMA_TO_DEVICE)
> > +             dma_inv_range((void *)address, size);
> > +}
>
> I cannot see how this will work?!?
> We are on a v8 architecture for a 64bit variant.
> But in cache.c we have only:
>
> DEFINE_CPU_FNS(v4)
> DEFINE_CPU_FNS(v5)
> DEFINE_CPU_FNS(v6)
> DEFINE_CPU_FNS(v7)
>

Cache.c isn't going to be built on AArch64, so it doesn't really
matter what's in it. V8_* cache functions are defined in cache-armv8.S
and there's no analog of  DEFINE_CPU_FNS() on AArch64.

> So I do not see how we call v8_inv_dcache_range() here.
> Do I miss something?
>

On AArch64 dma_inv_range() is defined as a wrapper around
v8_inv_dcache_range() in "ARM64: mmu: Invalidate memory before
remapping as DMA coherent" and exported to be available to other
compilation units in "ARM: mmu: Share code for dma_alloc_coherent()".
You can also see a pretty concise summary of it in this diff in this
bit:

diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index ed4aa00a8..2cb62370e 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -256,13 +256,6 @@ void dma_inv_range(void *ptr, size_t size)
        v8_inv_dcache_range(start, end);
 }

Hope this clarifies things.

Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-01-17 21:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17  6:38 [PATCH 00/12] ARM/ARM64 MMU code consolidation, zeroing of DMA coherent memory Andrey Smirnov
2019-01-17  6:38 ` [PATCH 01/12] ARM: mmu: Drop custom virt_to_phys/phys_to_virt Andrey Smirnov
2019-01-17  6:38 ` [PATCH 02/12] ARM: mmu: Simplify the use of dma_inv_range() Andrey Smirnov
2019-01-17  6:38 ` [PATCH 03/12] ARM: mmu: Share code for dma_(un)map_single() Andrey Smirnov
2019-01-17  6:38 ` [PATCH 04/12] ARM64: mmu: Use arch_remap_range() internaly Andrey Smirnov
2019-01-17  6:38 ` [PATCH 05/12] ARM64: mmu: Merge create_sections() and map_region() together Andrey Smirnov
2019-01-17  6:38 ` [PATCH 06/12] ARM: mmu: Share code for dma_free_coherent() Andrey Smirnov
2019-01-17  6:38 ` [PATCH 07/12] ARM64: mmu: Invalidate memory before remapping as DMA coherent Andrey Smirnov
2019-01-17  6:38 ` [PATCH 08/12] ARM: mmu: Share code for dma_alloc_coherent() Andrey Smirnov
2019-01-17 21:23   ` Sam Ravnborg
2019-01-17 21:54     ` Andrey Smirnov
2019-01-17 22:06       ` Sam Ravnborg
2019-01-17  6:38 ` [PATCH 09/12] ARM: mmu: Share code for dma_sync_single_for_cpu() Andrey Smirnov
2019-01-17 21:28   ` Sam Ravnborg
2019-01-17 21:50     ` Andrey Smirnov [this message]
2019-01-17 22:04       ` Sam Ravnborg
2019-01-17  6:38 ` [PATCH 10/12] ARM: mmu: Share sanity checking code in mmu_init() Andrey Smirnov
2019-01-17  6:38 ` [PATCH 11/12] ARM: mmu: Share code for arm_mmu_not_initialized_error() Andrey Smirnov
2019-01-17  6:38 ` [PATCH 12/12] ARM: mmu: Make sure DMA coherent memory is zeroed out Andrey Smirnov
2019-01-17 21:36   ` Sam Ravnborg
2019-01-17 22:00     ` Andrey Smirnov
2019-01-17 22:11       ` Sam Ravnborg
2019-01-17 21:40 ` [PATCH 00/12] ARM/ARM64 MMU code consolidation, zeroing of DMA coherent memory Sam Ravnborg
2019-01-17 22:01   ` Andrey Smirnov
2019-01-17 22:06   ` Sam Ravnborg

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=CAHQ1cqGG1GiXh-1yz_cG4DjGgfKi1Un+Yw4Xd7a6EZ76R-Bt4Q@mail.gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=sam@ravnborg.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