1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * RAID6 syndrome calculation using ARM NEON intrinsics 4 * 5 * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org> 6 */ 7 8 #include <asm/simd.h> 9 #include "algos.h" 10 11 /* 12 * There are 2 reasons these wrappers are kept in a separate compilation unit 13 * from the actual implementations in neonN.c (generated from neon.uc by 14 * unroll.awk): 15 * - the actual implementations use NEON intrinsics, and the GCC support header 16 * (arm_neon.h) is not fully compatible (type wise) with the kernel; 17 * - the neonN.c files are compiled with -mfpu=neon and optimization enabled, 18 * and we have to make sure that we never use *any* NEON/VFP instructions 19 * outside a kernel_neon_begin()/kernel_neon_end() pair. 20 */ 21 22 #define RAID6_NEON_WRAPPER(_n) \ 23 static void raid6_neon ## _n ## _gen_syndrome(int disks, \ 24 size_t bytes, void **ptrs) \ 25 { \ 26 void raid6_neon ## _n ## _gen_syndrome_real(int, \ 27 unsigned long, void**); \ 28 scoped_ksimd() \ 29 raid6_neon ## _n ## _gen_syndrome_real(disks, \ 30 (unsigned long)bytes, ptrs); \ 31 } \ 32 static void raid6_neon ## _n ## _xor_syndrome(int disks, \ 33 int start, int stop, \ 34 size_t bytes, void **ptrs) \ 35 { \ 36 void raid6_neon ## _n ## _xor_syndrome_real(int, \ 37 int, int, unsigned long, void**); \ 38 scoped_ksimd() \ 39 raid6_neon ## _n ## _xor_syndrome_real(disks, \ 40 start, stop, (unsigned long)bytes, ptrs);\ 41 } \ 42 struct raid6_calls const raid6_neonx ## _n = { \ 43 .gen_syndrome = raid6_neon ## _n ## _gen_syndrome, \ 44 .xor_syndrome = raid6_neon ## _n ## _xor_syndrome, \ 45 .name = "neonx" #_n, \ 46 } 47 48 RAID6_NEON_WRAPPER(1); 49 RAID6_NEON_WRAPPER(2); 50 RAID6_NEON_WRAPPER(4); 51 RAID6_NEON_WRAPPER(8); 52