Skip to contentSkip to conversation

openrisc/cache: disable icache during invalidation

PATCH New Stefan Kristiansson 2 participants 2 messages Apr 24, 2012 Openrisc architecture

lore
Share & tools
lore

Stefan Kristiansson

author maintainer
#0 lore raw

PATCH 1/1 openrisc/cache: disable icache during invalidation

invalidating the memory area that is being executed while icache is on is a bit adventurous, make sure it's turned off during this operation

---
 arch/openrisc/cpu/cache.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/openrisc/cpu/cache.c +4 -0
index 2a73a4f..fedfd89 100644
@@ -44,11 +44,15 @@ void invalidate_dcache_range(unsigned long addr, unsigned long stop)
 static void invalidate_icache_range(unsigned long addr, unsigned long stop)
 {
 	ulong block_size = (mfspr(SPR_ICCFGR) & SPR_ICCFGR_CBS) ? 32 : 16;
+	ulong ie = icache_status();
 
+	icache_disable();
 	while (addr < stop) {
 		mtspr(SPR_ICBIR, addr);
 		addr += block_size;
 	}
+	if (ie)
+		icache_enable();
 }
 
 void flush_cache(unsigned long addr, unsigned long size)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 openrisc/cache: disable icache during invalidation

Quoted 3 lines · On Tuesday 24 April 2012 01:34:31 Stefan Kristiansson wrote:

invalidating the memory area that is being executed while icache is on is a bit adventurous, make sure it's turned off during this operation

sounds like a bug in the chip. you should be able to icache invalidate the active insn all you like.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120424/413f0770/attachment.pgp>