ARM: uniphier: fix range invalidate for outer cache
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 17 Jan 2016 01:13:18 +0000 (10:13 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 19 Jan 2016 23:40:02 +0000 (08:40 +0900)
If invalidate operation is invoked against a cache-unaliged region,
the both ends of the region should be flushed, not invalidated.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/arm/mach-uniphier/cache_uniphier.c

index 6c773161ba41be29a52aec44a8d52f05051e11cb..8435a3300a4626f1cbccd46ee8c4fb091d3bf622 100644 (file)
@@ -105,6 +105,29 @@ void v7_outer_cache_flush_range(u32 start, u32 end)
 
 void v7_outer_cache_inval_range(u32 start, u32 end)
 {
+       if (start & (SSC_LINE_SIZE - 1)) {
+               start &= ~(SSC_LINE_SIZE - 1);
+               __uniphier_cache_maint_range(start, SSC_LINE_SIZE,
+                                            SSCOQM_CM_WB_INV);
+               start += SSC_LINE_SIZE;
+       }
+
+       if (start >= end) {
+               uniphier_cache_sync();
+               return;
+       }
+
+       if (end & (SSC_LINE_SIZE - 1)) {
+               end &= ~(SSC_LINE_SIZE - 1);
+               __uniphier_cache_maint_range(end, SSC_LINE_SIZE,
+                                            SSCOQM_CM_WB_INV);
+       }
+
+       if (start >= end) {
+               uniphier_cache_sync();
+               return;
+       }
+
        uniphier_cache_maint_range(start, end, SSCOQM_CM_INV);
 }