Skip to content

Commit 365f866

Browse files
Ley Foon TanDinh Nguyen
authored andcommitted
nios2: fix cache coherency issue when debug with gdb
Remove the end address checking for flushda function. We need to flush each address line for flushda instruction, from start to end address. This is because flushda instruction only flush the cache if tag and line fields are matched. Change to use ldwio instruction (bypass cache) to load the instruction that causing trap. Our interest is the actual instruction that executed by the processor, this should be uncached. Note, EA address might be an userspace cached address. Signed-off-by: Ley Foon Tan <lftan@altera.com>
1 parent 77c9b87 commit 365f866

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

arch/nios2/kernel/entry.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ ENTRY(inthandler)
148148
***********************************************************************
149149
*/
150150
ENTRY(handle_trap)
151-
ldw r24, -4(ea) /* instruction that caused the exception */
151+
ldwio r24, -4(ea) /* instruction that caused the exception */
152152
srli r24, r24, 4
153153
andi r24, r24, 0x7c
154154
movia r9,trap_table

arch/nios2/mm/cacheflush.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ static void __flush_dcache(unsigned long start, unsigned long end)
2323
end += (cpuinfo.dcache_line_size - 1);
2424
end &= ~(cpuinfo.dcache_line_size - 1);
2525

26-
if (end > start + cpuinfo.dcache_size)
27-
end = start + cpuinfo.dcache_size;
28-
2926
for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) {
3027
__asm__ __volatile__ (" flushda 0(%0)\n"
3128
: /* Outputs */

0 commit comments

Comments
 (0)