public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nios2: convert cache flush to use dm cpu data
Date: Fri, 9 Oct 2015 16:40:50 +0200	[thread overview]
Message-ID: <201510091640.50139.marex@denx.de> (raw)
In-Reply-To: <CAFiDJ58xgPG6uRs3nAgkavX-=VK_mR0Sz0Wm75MQ5c5Y55Dwjw@mail.gmail.com>

On Friday, October 09, 2015 at 04:49:03 AM, Ley Foon Tan wrote:
> On Fri, Oct 9, 2015 at 5:39 AM, Marek Vasut <marex@denx.de> wrote:
> >> +
> >> +DECLARE_GLOBAL_DATA_PTR;
> >> +
> >> +static void __flush_dcache_all(unsigned long start, unsigned long end)
> >> +{
> >> +     unsigned long addr;
> >> +
> >> +     start &= ~(gd->arch.dcache_line_size - 1);
> > 
> > I'd suggest to use GENMASK() here, but I don't think we picked this from
> > Linux just yet.
> > 
> >> +     end += (gd->arch.dcache_line_size - 1);
> >> +     end &= ~(gd->arch.dcache_line_size - 1);
> > 
> > Is this an attempt at poor-mans' rounding ? I think you want to implment
> > something like arch/arm/cpu/arm926ejs/cache.c check_cache_range() and NOT
> > do any rounding here. The reason for that is that if you do rounding, you
> > might accidentally corrupt a piece of memory which was just delivered via
> > DMA before you did the flush.
> 
> The code above is to convert the address to dcache line size.

So it's aligning the unaligned accesses, correct?

> arch/arm/cpu/arm926ejs/cache.c check_cache_range() will skip the cache
> flushing if it is unaligned to cache line size.

That's right, unaligned cache flushes/invalidations should not happen, ever.

> I'm not sure how
> frequent U-boot access to non-aligned cache line size.

They must not ever happen, if some driver does them, the driver needs to be
fixed.

Best regards,
Marek Vasut

  parent reply	other threads:[~2015-10-09 14:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06  8:20 [U-Boot] [PATCH] nios2: convert cache flush to use dm cpu data Thomas Chou
2015-10-08 21:39 ` Marek Vasut
2015-10-09  2:49   ` Ley Foon Tan
2015-10-09  8:00     ` Thomas Chou
2015-10-09 14:42       ` Marek Vasut
2015-10-10  5:55         ` Thomas Chou
2015-10-10  6:32           ` Thomas Chou
2015-10-10 18:18             ` Marek Vasut
2015-10-11  0:38               ` Thomas Chou
2015-10-11 12:15                 ` Marek Vasut
2015-10-12  0:34                   ` Thomas Chou
2015-10-12 10:30                     ` Marek Vasut
2015-10-12 13:12                       ` Thomas Chou
2015-10-12 13:29                         ` Marek Vasut
2015-10-12 13:49                           ` Wolfgang Denk
2015-10-13  1:04                           ` Thomas Chou
2015-10-16 23:03                             ` Marek Vasut
2015-10-17  3:22                               ` Thomas Chou
2015-10-17 11:44                                 ` Marek Vasut
2015-10-10 18:12           ` Marek Vasut
2015-10-09 14:40     ` Marek Vasut [this message]
2015-10-09 12:58 ` [U-Boot] [PATCH v2] " Thomas Chou

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=201510091640.50139.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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