Skip to content

Commit

Permalink
sh: Account for cache aliases in flush_icache_range()
Browse files Browse the repository at this point in the history
The icache may also contain aliases so we must account for them just
like we do when manipulating the dcache. We usually get away with
aliases in the icache because the instructions that are read from memory
are read-only, i.e. they never change. However, the place where this
bites us is when the code has been modified.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Matt Fleming authored and Paul Mundt committed Nov 9, 2009
1 parent 421b541 commit a9d244a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/sh/mm/cache-sh4.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,18 @@ static void __uses_jump_to_uncached sh4_flush_icache_range(void *args)

for (v = start; v < end; v += L1_CACHE_BYTES) {
unsigned long icacheaddr;
int j, n;

__ocbwb(v);

icacheaddr = CACHE_IC_ADDRESS_ARRAY | (v &
cpu_data->icache.entry_mask);

/* Clear i-cache line valid-bit */
n = boot_cpu_data.icache.n_aliases;
for (i = 0; i < cpu_data->icache.ways; i++) {
__raw_writel(0, icacheaddr);
for (j = 0; j < n; j++)
__raw_writel(0, icacheaddr + (j * PAGE_SIZE));
icacheaddr += cpu_data->icache.way_incr;
}
}
Expand Down

0 comments on commit a9d244a

Please sign in to comment.