Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [patch 2/2] arm: Implement l2x0 cache disable function
Date: Fri, 2 Jul 2010 18:39:31 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1007021835512.2525@localhost.localdomain> (raw)
In-Reply-To: <1278087010.10162.271.camel@e102109-lin.cambridge.arm.com>

On Fri, 2 Jul 2010, Catalin Marinas wrote:

> On Fri, 2010-07-02 at 16:29 +0100, Thomas Gleixner wrote:
> > On Fri, 2 Jul 2010, Catalin Marinas wrote:
> > 
> > > On Thu, 2010-07-01 at 17:05 +0100, Thomas Gleixner wrote:
> > > > This function is called from kexec code before the inner caches are
> > > > disabled to prevent random crashes in the new kernel.
> > > >
> > > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > > > Index: linux-2.6/arch/arm/mm/cache-l2x0.c
> > > > ===================================================================
> > > > --- linux-2.6.orig/arch/arm/mm/cache-l2x0.c
> > > > +++ linux-2.6/arch/arm/mm/cache-l2x0.c
> > > > @@ -206,6 +206,12 @@ static void l2x0_flush_range(unsigned lo
> > > >         spin_unlock_irqrestore(&l2x0_lock, flags);
> > > >  }
> > > >
> > > > +static void l2x0_cache_disable(void)
> > > > +{
> > > > +       l2x0_inv_all();
> > > > +       writel(0, l2x0_base + L2X0_CTRL);
> > > > +}
> > >
> > > Even if we go this route, we need an l2x0_flush_all() rather than
> > > invalidate here as the latter removes dirty cache lines without evicting
> > > them first.
> > 
> > True, but that's an implementation detail. What's more important is to
> > make a decision how to solve the problem as kexec is completely
> > unusable for all L2 systems right now.
> 
> My view is that we should try to find why cache flushing doesn't work
> but unfortunately I don't have any spare time to look into this (would
> need to use tools like ICE debugging/tracing).

Simply because you need to flush the cache in the decompressor of the
new kernel before jumping into it and I doubt that Russell will be
happy about adding an utter L2 mess to the decompressor.

> > I think the correct way to deal with this is disabling L2 and let the
> > OMAP3 folks deal with it. As Tony said there is some SMI magic to do
> > that, so we can do the following:
> > 
> > In l2x0_init()
> > 
> >    if (!l2_enabled()) {
> >       if (non_secure()) {
> >          omap_smi_magic_l2_enable();
> >          outer_cache.disable = omap_smi_magic_l2_disable;
> >       } else {
> >          sane_l2_enable();
> >          outer_cache.disable = sane_l2_disable;
> >       }
> >    }
> 
> The non_secure() bit is the key. AFAIK there isn't an easy way to check
> whether you are running in secure or non-secure mode (I think there is
> some CP14 debug register telling this but those registers aren't
> mandatory in a CPU implementation).

And how does the kernel decide whether it needs to use that SMI code
in sleep34xx.S or not ?

Thanks,

	tglx

  reply	other threads:[~2010-07-02 16:39 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 16:05 [patch 0/2] ARM: Disable outer cache before kexec call Thomas Gleixner
2010-07-01 16:05 ` [patch 1/2] arm: Disable outer (L2) cache in kexec Thomas Gleixner
2010-07-01 16:05 ` [patch 2/2] arm: Implement l2x0 cache disable function Thomas Gleixner
     [not found]   ` <AANLkTillHUsJF8brOtHh8tl9Us493GsWfpjhXXsFExY7@mail.gmail.com>
2010-07-02 11:23     ` srinidhi
2010-07-02 11:47   ` Catalin Marinas
2010-07-02 15:29     ` Thomas Gleixner
2010-07-02 16:10       ` Catalin Marinas
2010-07-02 16:39         ` Thomas Gleixner [this message]
2010-07-02 16:51           ` Shilimkar, Santosh
2010-07-02 16:54           ` Catalin Marinas
2010-07-02 17:23             ` Russell King - ARM Linux
2010-07-03  7:01             ` Shilimkar, Santosh
2010-07-04 14:07               ` Catalin Marinas
2010-07-04 15:31                 ` Shilimkar, Santosh
2010-07-04 19:09               ` Russell King - ARM Linux
2010-07-05  9:12                 ` Catalin Marinas
2010-07-02 17:21         ` Russell King - ARM Linux
2010-07-02 16:48       ` Shilimkar, Santosh
2010-07-01 16:14 ` [patch 0/2] ARM: Disable outer cache before kexec call Catalin Marinas
2010-07-01 16:28   ` Thomas Gleixner
2010-07-01 16:35     ` Catalin Marinas
2010-07-01 16:52       ` Thomas Gleixner
2010-07-01 17:14         ` Catalin Marinas
2010-07-02 10:58         ` Tony Lindgren
2010-07-01 16:38     ` Shilimkar, Santosh
2010-07-01 16:41       ` Catalin Marinas
2010-07-01 16:44         ` Shilimkar, Santosh
2010-07-01 17:06       ` Russell King - ARM Linux
2010-07-01 17:21         ` Russell King - ARM Linux
2010-07-01 17:34           ` Catalin Marinas
2010-07-01 17:48             ` Russell King - ARM Linux
2010-07-01 20:08           ` Thomas Gleixner

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=alpine.LFD.2.00.1007021835512.2525@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=linux-arm-kernel@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