Skip to content

Commit a781d1e

Browse files
mflemingpmundt
authored andcommitted
sh: Drop associative writes for SH-4 cache flushes.
When flushing/invalidating the icache/dcache via the memory-mapped IC/OC address arrays, the associative bit should only be used in conjunction with virtual addresses. However, we currently flush cache lines based on physical address, so stop using the associative bit. It is a better strategy to use non-associative writes (and physical tags) for flushing the caches anyway, because flushing by virtual address (as with the A-bit set) requires a valid TLB entry for that virtual address. If one does not exist in the TLB no exception is generated and the flush is silently ignored. This is also future-proofing for SH-4A parts which are gradually phasing out associative writes to the cache array due to the aforementioned case of certain flushes silently turning in to nops. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent 7e01c94 commit a781d1e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎arch/sh/mm/cache-sh4.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static inline void flush_cache_one(unsigned long start, unsigned long phys)
9898
exec_offset = cached_to_uncached;
9999

100100
local_irq_save(flags);
101-
__flush_cache_one(start | SH_CACHE_ASSOC, phys, exec_offset);
101+
__flush_cache_one(start, phys, exec_offset);
102102
local_irq_restore(flags);
103103
}
104104

@@ -123,7 +123,7 @@ static void sh4_flush_dcache_page(void *arg)
123123

124124
/* Loop all the D-cache */
125125
n = boot_cpu_data.dcache.n_aliases;
126-
for (i = 0; i <= n; i++, addr += PAGE_SIZE)
126+
for (i = 0; i < n; i++, addr += PAGE_SIZE)
127127
flush_cache_one(addr, phys);
128128
}
129129

0 commit comments

Comments
 (0)