1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 3 #include <asm/cputable.h> 4 5 extern const struct raid6_calls raid6_altivec1; 6 extern const struct raid6_calls raid6_altivec2; 7 extern const struct raid6_calls raid6_altivec4; 8 extern const struct raid6_calls raid6_altivec8; 9 extern const struct raid6_calls raid6_vpermxor1; 10 extern const struct raid6_calls raid6_vpermxor2; 11 extern const struct raid6_calls raid6_vpermxor4; 12 extern const struct raid6_calls raid6_vpermxor8; 13 14 static __always_inline void __init arch_raid6_init(void) 15 { 16 raid6_algo_add_default(); 17 18 /* This assumes either all CPUs have Altivec or none does */ 19 if (cpu_has_feature(CPU_FTR_ALTIVEC)) { 20 raid6_algo_add(&raid6_altivec1); 21 raid6_algo_add(&raid6_altivec2); 22 raid6_algo_add(&raid6_altivec4); 23 raid6_algo_add(&raid6_altivec8); 24 } 25 if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP) && 26 cpu_has_feature(CPU_FTR_ARCH_207S)) { 27 raid6_algo_add(&raid6_vpermxor1); 28 raid6_algo_add(&raid6_vpermxor2); 29 raid6_algo_add(&raid6_vpermxor4); 30 raid6_algo_add(&raid6_vpermxor8); 31 } 32 } 33