From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] lib_ppc: rework the flush_cache
Date: Wed, 03 Dec 2008 10:33:28 -0600 [thread overview]
Message-ID: <4936B4D8.5020503@freescale.com> (raw)
In-Reply-To: <79C363B768933F4FB918025FF7EB888856A042@zch01exm21.fsl.freescale.net>
Liu Dave wrote:
> The lib_ppc version basically is as below.
> void flush_cache (ulong start_addr, ulong size)
> {
> ulong addr, end_addr = start_addr + size;
> addr = start_addr & (CONFIG_SYS_CACHELINE_SIZE - 1);
> for (addr = start_addr; addr < end_addr; addr += CONFIG_SYS_CACHELINE_SIZE) {
> asm ("dcbst 0,%0": :"r" (addr));
> }
> }
>
> so, you are not completely right, the flush is from start_addr.
Ah, right, the first addr assignment is just dead code.
>>> + start = start_addr & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
>>> + end = (start_addr + size) & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
>> end = start_addr + size - 1;
>>
>> The rounding is unnecessary for end, and without the - 1, if
>> start_addr + size is on a cacheline boundary, you'll flush one
>> cache line too many (which might not be mapped, or might cause end
>> to wrap around to zero if flushing at the end of the address
>> space).
>>
>
> I don't see what is the problem in my patch at here.
start_addr = 0
size = 0x1000
start will be 0
end will be 0x1000
The loop will flush the cache line at 0x1000, because it uses <= rather
than <. That is outside the area that was requested to be flushed.
Maybe it's not mapped. Or, maybe start + size = 0 and nothing gets flushed.
-Scott
next parent reply other threads:[~2008-12-03 16:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <79C363B768933F4FB918025FF7EB888856A042@zch01exm21.fsl.freescale.net>
2008-12-03 16:33 ` Scott Wood [this message]
2008-12-03 23:23 ` [U-Boot] [PATCH] lib_ppc: rework the flush_cache Liu Dave
2008-12-02 3:47 Dave Liu
2008-12-02 18:13 ` Scott Wood
2008-12-03 12:56 ` Liu Dave
2008-12-14 11:48 ` Wolfgang Denk
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=4936B4D8.5020503@freescale.com \
--to=scottwood@freescale.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.