From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/5] dcache support for Raspberry Pi 1
Date: Mon, 6 Jul 2015 23:26:41 +0200 [thread overview]
Message-ID: <20150706232641.34728828@lilith> (raw)
In-Reply-To: <1635379.iokOHN4OQt@kongar>
Hello Alexander,
On Mon, 06 Jul 2015 20:24:31 +0200, Alexander Stein
<alexanders83@web.de> wrote:
> Hello Albert,
>
> On Monday 06 July 2015, 09:39:40 wrote Albert ARIBAUD:
> > On Sat, 4 Jul 2015 11:48:39 +0200, Alexander Stein
> > <alexanders83@web.de> wrote:
> >
> > > dcache supprt increases the MMC read performance on RPI 1 from 5,4 MiB/s to
> > > 12.3 MiB/s. It doesn't seem to have any affect on RPI 2 though. I just get
> > > error messages about non-cacheline aligned address upon invalidation.
> >
> > Could it be that code needed to support dcache is not the same for
> > rpi_2's bcm2836 than it is for rpi's bcm2835?
>
> Sure, bcm2835 is a armv6 while bcm2836 is a armv7.
>
> > Anyway: if code properly handles unaligned addresses then it should not
> > throw an error message about it. Can you look into why the error is
> > thrown?
>
> Apparently it does not handle non-cacheline aligned addresses transparently or silently.
>
> Here is the part of the code:
> > static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
> > {
> > /*
> > * If start address is not aligned to cache-line do not
> > * invalidate the first cache-line
> > */
> > if (start & (line_len - 1)) {
> > printf("ERROR: %s - start address is not aligned - 0x%08x\n",
> > __func__, start);
> > /* move to next cache line */
> > start = (start + line_len - 1) & ~(line_len - 1);
> > }
>
> I don't know why (a) the cache invalidation is only done from the next cache line and (b) why this can't be done transparently without printing an error.
> But currently I'm not keen on fiddling with armv7 caches.
Well, I can see why.
Let's assume were invalidating the second half of a cache line because
that's where a buffer starts which we want to force-read from external
memory because some device fille dthis buffer with important data.
Now, most probably the compiler and linker will have used the addresses
before our buffer to map some variables which may be unrelated to the
buffer.
At the time we're told to invalidate the buffer, these variables may be
modified in-cache but not yet written out to external memory. If we
invalidate the first cache line, then we erase these modifications --
they're lost.
Now, this is an unsolvable problem -- we can't flush these variables
before invalidating, because then we would flush the whole cache line,
which would overwrite and trash the buffer in external memory.
So anyway, we're doomed; there is nothing we can do -- hence the ERROR
message. From the on, we can either just give up and go hang(), or we
can try to save whatever can be, skip the half cache line and start
invalidating at the next boundary.
(same goes for the last address: it has to be at the end of a cache
line, or else we can neither invalidate nor flush.)
> Best regards,
> Alexander
Amicalement,
--
Albert.
next prev parent reply other threads:[~2015-07-06 21:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-04 9:48 [U-Boot] [PATCH 0/5] dcache support for Raspberry Pi 1 Alexander Stein
2015-07-04 9:48 ` [U-Boot] [PATCH 1/5] arm1176/cpu: Match cache_flush to arm1136 Alexander Stein
2015-07-11 5:20 ` Stephen Warren
2015-07-12 7:23 ` Alexander Stein
2015-07-04 9:48 ` [U-Boot] [PATCH 2/5] arm1176/cpu: Add icache and dcache support Alexander Stein
2015-07-11 5:21 ` Stephen Warren
2015-07-12 7:26 ` Alexander Stein
2015-07-14 4:57 ` Stephen Warren
2015-07-04 9:48 ` [U-Boot] [PATCH 3/5] arm1176/cpu: Align cache flushing addresses to cacheline size Alexander Stein
2015-07-11 5:21 ` Stephen Warren
2015-07-04 9:48 ` [U-Boot] [PATCH 4/5] arm/mach-bcm283x/mbox: Flush and invalidate dcache when using fw mailbox Alexander Stein
2015-07-11 5:24 ` Stephen Warren
2015-07-04 9:48 ` [U-Boot] [PATCH 5/5] arm/rpi: Enable dcache Alexander Stein
2015-07-11 5:24 ` Stephen Warren
2015-07-12 7:30 ` Alexander Stein
2015-07-14 4:57 ` Stephen Warren
2015-07-06 7:39 ` [U-Boot] [PATCH 0/5] dcache support for Raspberry Pi 1 Albert ARIBAUD
2015-07-06 18:24 ` Alexander Stein
2015-07-06 21:26 ` Albert ARIBAUD [this message]
2015-07-08 18:15 ` Alexander Stein
2015-07-08 22:47 ` Albert ARIBAUD
2015-07-11 5:17 ` Stephen Warren
2015-07-12 8:10 ` Alexander Stein
2015-07-14 5:02 ` Stephen Warren
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=20150706232641.34728828@lilith \
--to=albert.u.boot@aribaud.net \
--cc=u-boot@lists.denx.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