From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: Do I need to invalidate caches before enabling (on ARMv7)?
Date: Sun, 7 Dec 2014 12:11:03 +0100 [thread overview]
Message-ID: <20141207111103.GV2129@pengutronix.de> (raw)
In-Reply-To: <20141207105823.GA21341@lunn.ch>
On Sun, Dec 07, 2014 at 11:58:23AM +0100, Andrew Lunn wrote:
> > That would match http://www.arm.linux.org.uk/developer/booting.php which
> > is good. I'd prefer if Linux handled stale data in the cache though for
> > two reasons:
> > - Usually bootloaders are not perfect in adhering to requirements that
> > are not obvious from testing.
> > - Stale caches introduce problems that are hard to debug.
>
> Can it handle stale data?
Yes, it can provided the cache is off adn the kernel image is correctly
flushed to RAM.
BTW that is the state that at least some Tegra machines come out of
reset with. That's why barebox invalidates the data cache before
enabling it.
> We had an issue with kirkwood boards with u-boot leaving the cache on
> when jumping into Linux. This causes corruption in the decompressed
> image as it was being decompressed. So by the time the kernel was
> running, it was too late, bad things had already happened and death
> was coming soon.
>
> There is clearly a difference between leaving caches on, and turning
> them off but not cleaning them. So maybe it is possible for the kernel
> to handle this?
Even handling the cache being on would be possible, that would result in
something like:
if cache_is_on():
# assume everything is fine, no stale entries
else:
invalidate_cache()
enable_cache()
not sure we want that complexity though. Still I think going from
enable_cache()
as it is now to
invalidate_cache()
enable_cache()
would be nice. This would for example handle the case that the
bootloader on Tegra and machines with similar requirements doesn't make
use of the cache at all.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2014-12-07 11:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 10:03 Do I need to invalidate caches before enabling (on ARMv7)? Uwe Kleine-König
2014-12-06 21:00 ` Afzal Mohammed
2014-12-07 10:01 ` Uwe Kleine-König
2014-12-07 10:58 ` Andrew Lunn
2014-12-07 11:11 ` Uwe Kleine-König [this message]
2014-12-07 11:27 ` Andrew Lunn
2014-12-07 11:38 ` Uwe Kleine-König
2014-12-07 11:26 ` Afzal Mohammed
2014-12-08 11:59 ` Catalin Marinas
2014-12-15 14:30 ` Lorenzo Pieralisi
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=20141207111103.GV2129@pengutronix.de \
--to=u.kleine-koenig@pengutronix.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;
as well as URLs for NNTP newsgroup(s).