1 #ifndef __ARM_CPUERRATA_H__ 2 #define __ARM_CPUERRATA_H__ 3 4 #include <asm/cpufeature.h> 5 #include <asm/alternative.h> 6 7 void check_local_cpu_errata(void); 8 9 #ifdef CONFIG_HAS_ALTERNATIVE 10 11 #define CHECK_WORKAROUND_HELPER(erratum, feature, arch) \ 12 static inline bool check_workaround_##erratum(void) \ 13 { \ 14 if ( !IS_ENABLED(arch) ) \ 15 return false; \ 16 else \ 17 { \ 18 bool ret; \ 19 \ 20 asm volatile (ALTERNATIVE("mov %0, #0", \ 21 "mov %0, #1", \ 22 feature) \ 23 : "=r" (ret)); \ 24 \ 25 return unlikely(ret); \ 26 } \ 27 } 28 29 #else /* CONFIG_HAS_ALTERNATIVE */ 30 31 #define CHECK_WORKAROUND_HELPER(erratum, feature, arch) \ 32 static inline bool check_workaround_##erratum(void) \ 33 { \ 34 if ( !IS_ENABLED(arch) ) \ 35 return false; \ 36 else \ 37 return unlikely(cpus_have_cap(feature)); \ 38 } 39 40 #endif 41 42 CHECK_WORKAROUND_HELPER(766422, ARM32_WORKAROUND_766422, CONFIG_ARM_32) 43 CHECK_WORKAROUND_HELPER(834220, ARM64_WORKAROUND_834220, CONFIG_ARM_64) 44 45 #undef CHECK_WORKAROUND_HELPER 46 47 #endif /* __ARM_CPUERRATA_H__ */ 48 /* 49 * Local variables: 50 * mode: C 51 * c-file-style: "BSD" 52 * c-basic-offset: 4 53 * indent-tabs-mode: nil 54 * End: 55 */ 56