* [U-Boot] [PATCH] nios2: flush dcache after relocating code in start.S
@ 2010-03-24 6:16 Thomas Chou
2010-03-24 14:52 ` [U-Boot] [PATCH v2] nios2: flush data cache " Thomas Chou
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Chou @ 2010-03-24 6:16 UTC (permalink / raw)
To: u-boot
If we relocate the code, the data cache must be flushed before
we jump to the new code.
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
cpu/nios2/start.S | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/cpu/nios2/start.S b/cpu/nios2/start.S
index 4b4c560..b0a51a8 100644
--- a/cpu/nios2/start.S
+++ b/cpu/nios2/start.S
@@ -106,6 +106,17 @@ _cur: movhi r5, %hi(_cur - _start)
bne r5, r6, 2b
3:
+ /* DCACHE FLUSH -- after relocating code and data
+ */
+ movhi r4, %hi(CONFIG_SYS_DCACHELINE_SIZE)
+ ori r4, r4, %lo(CONFIG_SYS_DCACHELINE_SIZE)
+ movhi r5, %hi(CONFIG_SYS_DCACHE_SIZE)
+ ori r5, r5, %lo(CONFIG_SYS_DCACHE_SIZE)
+ mov r6, r0
+1: flushd 0(r6)
+ add r6, r6, r4
+ bltu r6, r5, 1b
+
/* ZERO BSS/SBSS -- bss and sbss are assumed to be adjacent
* and between __bss_start and _end.
*/
--
1.6.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] nios2: flush data cache after relocating code in start.S
2010-03-24 6:16 [U-Boot] [PATCH] nios2: flush dcache after relocating code in start.S Thomas Chou
@ 2010-03-24 14:52 ` Thomas Chou
2010-03-25 13:11 ` [U-Boot] Rejected: " Scott McNutt
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Chou @ 2010-03-24 14:52 UTC (permalink / raw)
To: u-boot
If we relocate the code, the data cache must be flushed before
we jump to the new code.
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
cpu/nios2/start.S | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/cpu/nios2/start.S b/cpu/nios2/start.S
index 31cd5b0..61784d8 100644
--- a/cpu/nios2/start.S
+++ b/cpu/nios2/start.S
@@ -98,6 +98,17 @@ _cur: movhi r5, %hi(_cur - _start)
stwio r7, 0(r5)
addi r5, r5, 4
bne r5, r6, 2b
+
+ /* DCACHE FLUSH -- after relocating code and data
+ */
+ movhi r4, %hi(CONFIG_SYS_DCACHELINE_SIZE)
+ ori r4, r4, %lo(CONFIG_SYS_DCACHELINE_SIZE)
+ movhi r5, %hi(CONFIG_SYS_DCACHE_SIZE)
+ ori r5, r5, %lo(CONFIG_SYS_DCACHE_SIZE)
+ mov r6, r0
+1: flushd 0(r6)
+ add r6, r6, r4
+ bltu r6, r5, 1b
3:
/* ZERO BSS/SBSS -- bss and sbss are assumed to be adjacent
--
1.6.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] Rejected: [PATCH v2] nios2: flush data cache after relocating code in start.S
2010-03-24 14:52 ` [U-Boot] [PATCH v2] nios2: flush data cache " Thomas Chou
@ 2010-03-25 13:11 ` Scott McNutt
0 siblings, 0 replies; 3+ messages in thread
From: Scott McNutt @ 2010-03-25 13:11 UTC (permalink / raw)
To: u-boot
Hi Thomas,
Patch is reject.
> diff --git a/cpu/nios2/start.S b/cpu/nios2/start.S
> index 31cd5b0..61784d8 100644
> --- a/cpu/nios2/start.S
> +++ b/cpu/nios2/start.S
> @@ -98,6 +98,17 @@ _cur: movhi r5, %hi(_cur - _start)
> stwio r7, 0(r5)
--------^^^^^
The existing code uses stxio instructions, which by their
very purpose, bypass the cache. So there's no need to flush
the data cache.
One could argue that invalidating the _instruction_ cache
may be necessary ... but I doubt it, given that first
instructions after reset invalidate the entire instruction
cache. It would be a defensive nevertheless.
Regards,
--Scott
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-25 13:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-24 6:16 [U-Boot] [PATCH] nios2: flush dcache after relocating code in start.S Thomas Chou
2010-03-24 14:52 ` [U-Boot] [PATCH v2] nios2: flush data cache " Thomas Chou
2010-03-25 13:11 ` [U-Boot] Rejected: " Scott McNutt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox