* [U-Boot-Users] bugs in flush_cache
[not found] ` <48299557.4020706@ruby.dti.ne.jp>
@ 2008-05-13 15:58 ` Eyal Bari
2008-05-13 16:18 ` Shinya Kuribayashi
0 siblings, 1 reply; 3+ messages in thread
From: Eyal Bari @ 2008-05-13 15:58 UTC (permalink / raw)
To: u-boot
in your version of the function the iterated cache ops second argument was
start_addr which stay constant.
the second bug is that it doesn't iterate over the entire range:
for example:
if size is 42 and the cache line size is 32 - it takes two cache lines to
cache this buffer
your version will iterate only over one cache line
my version will iterate over two cache line covering the entire range
eyalb
On Tue, May 13, 2008 at 4:19 PM, Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
wrote:
> Eyal Bari wrote:
>
> > hi,
> >
> > i found two bugs in your flush_cache routine:
> > * it was only flushing the first cacheline in the range
> > * the loop was running one cacheline short
> >
> > the fixed version:
> > void flush_cache(ulong start_addr, ulong size)
> > {
> > unsigned long lsize = CFG_CACHELINE_SIZE;
> > unsigned long addr = start_addr & ~(lsize - 1);
> > unsigned long aend = (start_addr + size - 1 + lsize) & ~(lsize - 1);
> >
> > while (1) {
> > cache_op(Hit_Writeback_Inv_D, addr);
> > cache_op(Hit_Invalidate_I, addr);
> > if (addr == aend)
> > break;
> > addr += lsize;
> > }
> > }
> >
> > eyalb
> >
>
> Really? I don't think so.
>
> See Linux's include/asm-mips/r4kcache.h#413. This is the original.
>
>
> http://git.kernel.org/?p=linux/kernel/git/ralf/linux.git;a=blob;f=include/asm-mips/r4kcache.h;h=4c140db3678655975d2dde877d898a5f9861ad6e;hb=HEAD#l413
>
> Shinya
>
> P.S. If you don't mind, please add Cc: u-boot-users when replying.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20080513/7573c69c/attachment.htm
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot-Users] bugs in flush_cache
2008-05-13 15:58 ` [U-Boot-Users] bugs in flush_cache Eyal Bari
@ 2008-05-13 16:18 ` Shinya Kuribayashi
2008-05-13 18:16 ` Eyal Bari
0 siblings, 1 reply; 3+ messages in thread
From: Shinya Kuribayashi @ 2008-05-13 16:18 UTC (permalink / raw)
To: u-boot
Eyal Bari wrote:
> in your version of the function the iterated cache ops second argument
> was start_addr which stay constant.
Probably already fixed in the latest git. See below commit:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=188e94c370621708d13547d58dbc6ed3c5602aa8
> the second bug is that it doesn't iterate over the entire range:
> for example:
> if size is 42 and the cache line size is 32 - it takes two cache lines
> to cache this buffer
> your version will iterate only over one cache line
> my version will iterate over two cache line covering the entire range
Note that (addr == aend) is evaluated *after* cache_op()s.
If start_addr = 0x80000000, size = 42, CFG_CACHE_LINE_SIZE = 32,
cache_op( , 0x80000000) and cache_op( , 0x80000020) will be done.
I hope I don't miss anything.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot-Users] bugs in flush_cache
2008-05-13 16:18 ` Shinya Kuribayashi
@ 2008-05-13 18:16 ` Eyal Bari
0 siblings, 0 replies; 3+ messages in thread
From: Eyal Bari @ 2008-05-13 18:16 UTC (permalink / raw)
To: u-boot
yes - you are correct
thank you
On Tue, May 13, 2008 at 7:18 PM, Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
wrote:
> Eyal Bari wrote:
>
> > in your version of the function the iterated cache ops second argument
> > was start_addr which stay constant.
> >
>
> Probably already fixed in the latest git. See below commit:
>
>
> http://git.denx.de/?p=u-boot.git;a=commitdiff;h=188e94c370621708d13547d58dbc6ed3c5602aa8
>
> the second bug is that it doesn't iterate over the entire range:
> > for example:
> > if size is 42 and the cache line size is 32 - it takes two cache lines
> > to cache this buffer
> > your version will iterate only over one cache line
> > my version will iterate over two cache line covering the entire range
> >
>
> Note that (addr == aend) is evaluated *after* cache_op()s.
>
> If start_addr = 0x80000000, size = 42, CFG_CACHE_LINE_SIZE = 32,
> cache_op( , 0x80000000) and cache_op( , 0x80000020) will be done.
> I hope I don't miss anything.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20080513/8bbf5540/attachment.htm
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-13 18:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <44f4144c0805130526i18255f76l38633a38230816c4@mail.gmail.com>
[not found] ` <48299557.4020706@ruby.dti.ne.jp>
2008-05-13 15:58 ` [U-Boot-Users] bugs in flush_cache Eyal Bari
2008-05-13 16:18 ` Shinya Kuribayashi
2008-05-13 18:16 ` Eyal Bari
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.