import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / kernel / smp_tlb.c
index a98b62dca2faf9bbce7fbcb786d4c325513f7231..5b278d116a600dc842280a16d9ec19a286289a83 100644 (file)
@@ -71,19 +71,39 @@ static inline void ipi_flush_bp_all(void *ignored)
 }
 
 #ifdef CONFIG_ARM_ERRATA_798181
-static int erratum_a15_798181(void)
+bool (*erratum_a15_798181_handler)(void);
+
+static bool erratum_a15_798181_partial(void)
 {
-       unsigned int midr = read_cpuid_id();
+       asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
+       dsb();
+       return false;
+}
 
-       /* Cortex-A15 r0p0..r3p2 affected */
-       if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2)
-               return 0;
-       return 1;
+static bool erratum_a15_798181_broadcast(void)
+{
+       asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
+       dsb();
+       return true;
 }
-#else
-static int erratum_a15_798181(void)
+
+void erratum_a15_798181_init(void)
 {
-       return 0;
+       unsigned int midr = read_cpuid_id();
+       unsigned int revidr = read_cpuid(CPUID_REVIDR);
+
+       if (erratum_a15_798181_handler == erratum_a15_798181_broadcast)
+               return;
+
+       /* Cortex-A15 r0p0..r3p2 w/o ECO fix affected */
+       if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2 ||
+           (revidr & 0x210) == 0x210) {
+               return;
+       }
+       if (revidr & 0x10)
+               erratum_a15_798181_handler = erratum_a15_798181_partial;
+       else
+               erratum_a15_798181_handler = erratum_a15_798181_broadcast;
 }
 #endif
 
@@ -97,7 +117,6 @@ static void broadcast_tlb_a15_erratum(void)
        if (!erratum_a15_798181())
                return;
 
-       dummy_flush_tlb_a15_erratum();
        smp_call_function(ipi_flush_tlb_a15_erratum, NULL, 1);
 }
 
@@ -109,7 +128,6 @@ static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
        if (!erratum_a15_798181())
                return;
 
-       dummy_flush_tlb_a15_erratum();
        this_cpu = get_cpu();
        a15_erratum_get_cpumask(this_cpu, mm, &mask);
        smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);