aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2009-01-11 13:44:49 -0500
committerRalf Baechle <ralf@linux-mips.org>2009-01-30 16:32:57 -0500
commita8ca8b64e3fdfec17679cba0ca5ce6e3ffed092d (patch)
treebdb505a02de52a85483c2cc049350c8d14f2d806 /arch
parent012703e0fc9fb1d6cdf778c49f45b796a85ef5bc (diff)
MIPS: Avoid destructive invalidation on partial cachelines.
See discussion e9c3a7c20901051031y528d0d31r18d44c5096c59e0@mail.gmail.com. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/mm/c-r4k.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 6e99665ae86..c43f4b26a69 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -618,15 +618,35 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
618 if (cpu_has_inclusive_pcaches) { 618 if (cpu_has_inclusive_pcaches) {
619 if (size >= scache_size) 619 if (size >= scache_size)
620 r4k_blast_scache(); 620 r4k_blast_scache();
621 else 621 else {
622 unsigned long lsize = cpu_scache_line_size();
623 unsigned long almask = ~(lsize - 1);
624
625 /*
626 * There is no clearly documented alignment requirement
627 * for the cache instruction on MIPS processors and
628 * some processors, among them the RM5200 and RM7000
629 * QED processors will throw an address error for cache
630 * hit ops with insufficient alignment. Solved by
631 * aligning the address to cache line size.
632 */
633 cache_op(Hit_Writeback_Inv_SD, addr & almask);
634 cache_op(Hit_Writeback_Inv_SD,
635 (addr + size - 1) & almask);
622 blast_inv_scache_range(addr, addr + size); 636 blast_inv_scache_range(addr, addr + size);
637 }
623 return; 638 return;
624 } 639 }
625 640
626 if (cpu_has_safe_index_cacheops && size >= dcache_size) { 641 if (cpu_has_safe_index_cacheops && size >= dcache_size) {
627 r4k_blast_dcache(); 642 r4k_blast_dcache();
628 } else { 643 } else {
644 unsigned long lsize = cpu_dcache_line_size();
645 unsigned long almask = ~(lsize - 1);
646
629 R4600_HIT_CACHEOP_WAR_IMPL; 647 R4600_HIT_CACHEOP_WAR_IMPL;
648 cache_op(Hit_Writeback_Inv_D, addr & almask);
649 cache_op(Hit_Writeback_Inv_D, (addr + size - 1) & almask);
630 blast_inv_dcache_range(addr, addr + size); 650 blast_inv_dcache_range(addr, addr + size);
631 } 651 }
632 652