mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Cc: andrew.smirnov@gmail.com, lst@pengutronix.de
Subject: Re: [PATCH 1/2] ARM: cache_64: invalidate icache in arm_early_mmu_cache_flush
Date: Wed, 02 Oct 2019 09:46:25 +0200	[thread overview]
Message-ID: <6809ed13f6444459cccef85cddc5714d9ea5b22b.camel@pengutronix.de> (raw)
In-Reply-To: <d341943d-9833-aa58-e8bc-438611e9c93c@pengutronix.de>

On Wed, 2019-10-02 at 09:43 +0200, Ahmad Fatoum wrote:
> On 10/2/19 9:38 AM, Rouven Czerwinski wrote:
> > Hello Ahmad,
> > 
> > with these two patches applied, the NXP i.MX8MQ no longer starts
> > into
> > barebox.
> 
> Can you try each patch separately to see which one is the culprit?

Patch 2/2 is the culprit.

-rcz

> Thanks for testing,
> Ahmad
> 
> > - rcz
> > 
> > On Tue, 2019-10-01 at 11:09 +0200, Ahmad Fatoum wrote:
> > > So far arm_early_mmu_cache_flush has only been used in
> > > preparation
> > > for
> > > executing newly-written code. For this reason, on ARMv7 and
> > > below,
> > > it had always invalidate the icache after the dcache flush.
> > > We don't do this on ARM64, but sync_caches_for_execution depends
> > > on
> > > this,
> > > which had this comment that didn't hold true for ARM64:
> > > 
> > > > Despite the name arm_early_mmu_cache_flush not only flushes the
> > > > data cache, but also invalidates the instruction cache.
> > > 
> > > It might be worthwhile to decouple dcache flushing from icache
> > > invalidation, but for now, align what we do on ARM64 with what we
> > > do
> > > for
> > > 32-bit ARMs.
> > > 
> > > This fixes a potential read of stale instructions when loading
> > > second-stage barebox from the PBL with MMU disabled.
> > > 
> > > Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> > > ---
> > >  arch/arm/cpu/cache_64.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/arch/arm/cpu/cache_64.c b/arch/arm/cpu/cache_64.c
> > > index 45f01e8dc9cf..847323525424 100644
> > > --- a/arch/arm/cpu/cache_64.c
> > > +++ b/arch/arm/cpu/cache_64.c
> > > @@ -27,6 +27,7 @@ int arm_set_cache_functions(void)
> > >  void arm_early_mmu_cache_flush(void)
> > >  {
> > >  	v8_flush_dcache_all();
> > > +	v8_invalidate_icache_all();
> > >  }
> > >  
> > >  void arm_early_mmu_cache_invalidate(void)
> 
> 


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

  reply	other threads:[~2019-10-02  7:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01  9:09 Ahmad Fatoum
2019-10-01  9:09 ` [PATCH 2/2] ARM: cache_64: invalidate dcache in arm_early_mmu_cache_invalidate Ahmad Fatoum
2019-10-01  9:15   ` Ahmad Fatoum
2019-10-02  7:38 ` [PATCH 1/2] ARM: cache_64: invalidate icache in arm_early_mmu_cache_flush Rouven Czerwinski
2019-10-02  7:43   ` Ahmad Fatoum
2019-10-02  7:46     ` Rouven Czerwinski [this message]
2019-10-02  7:57       ` [PATCH] ARM: aarch64: save clobbered registers in __barebox_arm_entry Ahmad Fatoum
2019-10-02  9:30         ` Rouven Czerwinski
2019-10-02 10:45           ` Ahmad Fatoum

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=6809ed13f6444459cccef85cddc5714d9ea5b22b.camel@pengutronix.de \
    --to=r.czerwinski@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=lst@pengutronix.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