linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] ARM: cache-l2x0: remove __init annotation from initialization functions
Date: Sat, 17 Sep 2011 11:45:18 +0100	[thread overview]
Message-ID: <20110917104518.GD16381@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAGsJ_4xpc-8zzGkZ9LThqP7in27n6uX4LRGAf+AtoWTM4p=82w@mail.gmail.com>

On Fri, Sep 16, 2011 at 11:24:36AM +0800, Barry Song wrote:
> if we have a save/restore interface, it looks it will be very
> complicated. different l2 need to save different registers.

Why?  It's quite simple as far as I can see:

static u32 l2_aux_ctrl;

void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
{
	...
	aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);

	aux &= aux_mask;
	aux |= aux_val;

	l2_aux_ctrl = aux;
	...
}

void l2x0_resume(void)
{
	bool need_setup = false;

	if (l2_aux_ctrl != readl_relaxed(l2x0_base + L2X0_AUX_CTRL))
		need_setup = true;
	        
	if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
		/* Make sure that I&D is not locked down when starting */
		l2x0_unlock(cache_id);

		/* l2x0 controller is disabled */
		writel_relaxed(l2_aux_ctrl, l2x0_base + L2X0_AUX_CTRL);

		l2x0_inv_all();

		/* enable L2X0 */
		writel_relaxed(1, l2x0_base + L2X0_CTRL);
	}
}

and we can do a similar thing when initializing the PL310 and resuming
the PL310 - add a new outer_cache callback called 'resume' to be pointed
at the relevant resume function which knows which registers to restore.

> when we resume, we must disable l2 if bootloader has enabled it and
> restore all registers.

That's not possible in SoCs operating in non-secure mode from generic
code, as some of these registers will not be accessible.  They can only
be programmed from platform specific code due to the complexities of
dealing with the abhorrent secure monitor stuff.

I'm now starting to think that we don't actually want any resume code
at the L2 level - most SoCs will be operating in non-secure mode (I
believe it's only ARM's development platforms which operate in secure
mode) and so most of the generic code which will need to write to the
L2 control registers on resume will fail.

Even re-calling the initialization functions probably does nothing on
parts operating in secure mode - whether at boot or at resume.

  reply	other threads:[~2011-09-17 10:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-06  5:48 [PATCH v2 0/2] make reinitialization of ARM core components possible Shawn Guo
2011-09-06  5:48 ` [PATCH v2 1/2] ARM: cache-l2x0: remove __init annotation from initialization functions Shawn Guo
2011-09-06  7:19   ` Linus Walleij
2011-09-12  5:27     ` Shawn Guo
2011-09-14  8:42   ` Russell King - ARM Linux
2011-09-14  8:53     ` Santosh
2011-09-14 19:05       ` Russell King - ARM Linux
2011-09-14  9:59     ` Barry Song
2011-09-15  1:39     ` Shawn Guo
2011-09-15  8:32       ` Russell King - ARM Linux
2011-09-16  3:24         ` Barry Song
2011-09-17 10:45           ` Russell King - ARM Linux [this message]
2011-09-17 14:41             ` Barry Song
2011-09-17 14:56               ` Russell King - ARM Linux
2011-09-19  3:36                 ` Barry Song
2011-09-19  5:33                 ` Barry Song
2011-09-23 20:55                   ` Russell King - ARM Linux
2011-09-26  2:43                     ` Barry Song
2011-09-17 15:14             ` Shawn Guo
2011-09-06  5:48 ` [PATCH v2 2/2] ARM: smp_scu: remove __init annotation from scu_enable() Shawn Guo
2011-09-17  8:32   ` Shawn Guo
2011-09-22 15:04     ` Shawn Guo
2011-09-23 20:49       ` Russell King - ARM Linux
2011-09-24 10:39         ` Shawn Guo
2011-09-24 10:38           ` Russell King - ARM Linux
2011-09-06  6:01 ` [PATCH v2 0/2] make reinitialization of ARM core components possible Santosh
2011-09-06  7:02   ` Santosh
2011-09-12  5:41   ` Shawn Guo
2011-09-14 19:07     ` Russell King - ARM Linux
2011-09-15  1:53       ` Shawn Guo
2011-09-15  8:43         ` Russell King - ARM Linux

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=20110917104518.GD16381@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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;
as well as URLs for NNTP newsgroup(s).