From: marc_gonzalez@sigmadesigns.com (Marc Gonzalez)
To: linux-arm-kernel@lists.infradead.org
Subject: l2c: Kernel panic in l2c310_enable() in non-secure mode
Date: Thu, 15 Oct 2015 13:07:32 +0200 [thread overview]
Message-ID: <561F88F4.40401@sigmadesigns.com> (raw)
In-Reply-To: <561F7948.8080201@sigmadesigns.com>
On 15/10/2015 12:00, Marc Gonzalez wrote:
> On 14/10/2015 19:47, Russell King - ARM Linux wrote:
>
>> Wrong. Do _not_ enable FLZ in the Cortex-A9. FLZ needs the L2 cache
>> enabled _before_ the Cortex A9. This is not something you can do in
>> firmware/boot loader/etc. It has to be done by the kernel when the L2
>> cache is initialised.
>
> Can you tell me if the following setup is reasonable?
>
> (The important thing to note is that I do have control over the firmware.)
>
> l2c_enable and l2c_disable will hand control over to the firmware,
> which will handle the details of FLOZ:
>
> When enabling the L2, firmware will:
> A1) set L2CC_reg1_aux_control[0] to 1
> A2) enable the L2
> A3) set CP15_ACTLR bits 1,2,3 to 1
>
> When disabling the L2, firmware will:
> B1) clear CP15_ACTLR bits 1,2,3 to 0
> B2) disable the L2
> B3) clear L2CC_reg1_aux_control[0] to 0
>
> Thus, on my platform, Linux would no longer need to write CP15_ACTLR.
>
> Then I just need a platform-specific bool e.g. "firmware_handles_cp15_actlr"
> and check it where appropriate:
>
> In enable:
> if (!firmware_handles_cp15_actlr && (aux & L310_AUX_CTRL_FULL_LINE_ZERO)) {
> set_auxcr(get_auxcr() | BIT(3) | BIT(2) | BIT(1));
> cpu_notifier(l2c310_cpu_enable_flz, 0);
> }
>
> In disable:
> if (!firmware_handles_cp15_actlr && (l2x0_saved_regs.aux_ctrl & L310_AUX_CTRL_FULL_LINE_ZERO))
> set_auxcr(get_auxcr() & ~(BIT(3) | BIT(2) | BIT(1)));
>
>
> What do you think?
Come to think of it, instead of introducing this extra bool, I can
just ask the firmware author to set NSACR.NS_SMP, which effectively
turns the above set_auxcr() calls into NOPs. (And Rob noted that I'll
need that bit set anyway.)
That way, no changes are required in Linux, and everything magically
works as expected. I'll file an internal bug report.
One more question on this topic:
When Linux sees L310_AUX_CTRL_FULL_LINE_ZERO set, it then enables:
bit3 = Write full line of zeros mode
bit2 = L1 Prefetch enable
bit1 = L2 Prefetch hint enable
Why are the "prefetch enable" features bundled in the operation?
Regards.
next prev parent reply other threads:[~2015-10-15 11:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 14:17 l2c: Kernel panic in l2c310_enable() in non-secure mode Marc Gonzalez
2015-10-14 14:47 ` Marc Gonzalez
2015-10-14 17:06 ` Rob Herring
2015-10-15 8:56 ` Marc Gonzalez
2015-10-15 9:09 ` Russell King - ARM Linux
2015-10-14 17:47 ` Russell King - ARM Linux
2015-10-14 20:28 ` Mason
2015-10-15 10:00 ` Marc Gonzalez
2015-10-15 11:07 ` Marc Gonzalez [this message]
2015-10-16 9:51 ` Mason
2015-10-14 17:45 ` Russell King - ARM Linux
2015-10-14 19:34 ` Mason
2015-10-14 20:19 ` Peter Maydell
2015-10-14 21:08 ` Russell King - ARM Linux
2015-10-15 8:27 ` Marc Gonzalez
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=561F88F4.40401@sigmadesigns.com \
--to=marc_gonzalez@sigmadesigns.com \
--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).