[U-Boot-Users] [PATCH][RFC] lib_ppc: make the flush_cache stronger

Current flush_cache code does
1. clean the dcache with dcbst, but not invalidate dcache 2. invalidate icache
This patch use the dcbf instead of dcbst to have stronger semantic, clean the dcache and invalidate dcache.
Signed-off-by: Dave Liu daveliu@freescale.com ---
To meet DMA safe operation on cache enabled system, such as DMA_TO_DEVICE/DMA_FROM_DEVICE/DMA_BIDIRECTIONAL
We have two options:
1. Separate functions for them like linux kernel. A. clean dcache (dcbst) for DMA_TO_DEVICE B. invalidate dcache (dcbi) for DMA_FROM_DEVICE C. flush dcache (dcbf) for DMA_BIDIRECTIONAL. 2. Make current flush_cache stronger semanctic. use the dcbf instead of dcbst.
Which one is better? or you have better option? Please suggest.
Thanks, Dave
lib_ppc/cache.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib_ppc/cache.c b/lib_ppc/cache.c index 27e1a82..f4039ba 100644 --- a/lib_ppc/cache.c +++ b/lib_ppc/cache.c @@ -34,9 +34,9 @@ void flush_cache (ulong start_addr, ulong size) for (addr = start_addr; addr < end_addr; addr += CFG_CACHELINE_SIZE) { - asm ("dcbst 0,%0": :"r" (addr)); + asm ("dcbf 0,%0": :"r" (addr)); } - asm ("sync"); /* Wait for all dcbst to complete on bus */ + asm ("sync"); /* Wait for all dcbf to complete on bus */
for (addr = start_addr; addr < end_addr;

In message 1208236923.3656.15.camel@localhost.localdomain you wrote:
Current flush_cache code does
- clean the dcache with dcbst, but not invalidate dcache
- invalidate icache
This patch use the dcbf instead of dcbst to have stronger semantic, clean the dcache and invalidate dcache.
On which processors did you test the changes? I have some unclear memories of dcbf having problems on for example MPC8xx ?
We have two options:
- Separate functions for them like linux kernel. A. clean dcache (dcbst) for DMA_TO_DEVICE B. invalidate dcache (dcbi) for DMA_FROM_DEVICE C. flush dcache (dcbf) for DMA_BIDIRECTIONAL.
- Make current flush_cache stronger semanctic. use the dcbf instead of dcbst.
Which one is better? or you have better option? Please suggest.
We discussed this a bit on IRC; Kumar suggested to go for 1., and I agree.
Best regards,
Wolfgang Denk

Current flush_cache code does
- clean the dcache with dcbst, but not invalidate dcache
- invalidate icache
This patch use the dcbf instead of dcbst to have stronger semantic, clean the dcache and invalidate dcache.
On which processors did you test the changes? I have some unclear memories of dcbf having problems on for example MPC8xx ?
on 83xx parts. I remember the 601 processor not support the dcbf.
We have two options:
- Separate functions for them like linux kernel. A. clean dcache (dcbst) for DMA_TO_DEVICE B. invalidate dcache (dcbi) for DMA_FROM_DEVICE C. flush dcache (dcbf) for DMA_BIDIRECTIONAL.
- Make current flush_cache stronger semanctic. use the dcbf instead of dcbst.
Which one is better? or you have better option? Please suggest.
We discussed this a bit on IRC; Kumar suggested to go for 1., and I agree.
Where is the IRC? Could you point it to me?
Thanks, Dave

In message 1209119284.3656.5.camel@localhost.localdomain you wrote:
On which processors did you test the changes? I have some unclear memories of dcbf having problems on for example MPC8xx ?
on 83xx parts. I remember the 601 processor not support the dcbf.
OK, so cannot use the patch you suggested.
We have two options:
- Separate functions for them like linux kernel. A. clean dcache (dcbst) for DMA_TO_DEVICE B. invalidate dcache (dcbi) for DMA_FROM_DEVICE C. flush dcache (dcbf) for DMA_BIDIRECTIONAL.
- Make current flush_cache stronger semanctic. use the dcbf instead of dcbst.
Which one is better? or you have better option? Please suggest.
We discussed this a bit on IRC; Kumar suggested to go for 1., and I agree.
Where is the IRC? Could you point it to me?
That's #u-boot at irc.freenode.org
Best regards,
Wolfgang Denk

On Apr 25, 2008, at 6:15 AM, Wolfgang Denk wrote:
In message 1209119284.3656.5.camel@localhost.localdomain you wrote:
On which processors did you test the changes? I have some unclear memories of dcbf having problems on for example MPC8xx ?
on 83xx parts. I remember the 601 processor not support the dcbf.
OK, so cannot use the patch you suggested.
u-boot doesn't support any 601 systems and we should keep it that way.
- k
participants (3)
-
Dave Liu
-
Kumar Gala
-
Wolfgang Denk