Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/raid6: build proper files on corresponding arch

sse and avx2 stuff only exist on x86 arch, and we don't need to build
altivec on x86. And we can do that at lib/raid6/Makefile.

Proposed-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>

authored by

Yuanhan Liu and committed by
NeilBrown
4f8c55c5 2c935842

+28 -27
+6 -3
lib/raid6/Makefile
··· 1 1 obj-$(CONFIG_RAID6_PQ) += raid6_pq.o 2 2 3 - raid6_pq-y += algos.o recov.o recov_ssse3.o recov_avx2.o tables.o int1.o int2.o int4.o \ 4 - int8.o int16.o int32.o altivec1.o altivec2.o altivec4.o \ 5 - altivec8.o mmx.o sse1.o sse2.o avx2.o 3 + raid6_pq-y += algos.o recov.o tables.o int1.o int2.o int4.o \ 4 + int8.o int16.o int32.o 5 + 6 + raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o 7 + raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o 8 + 6 9 hostprogs-y += mktables 7 10 8 11 quiet_cmd_unroll = UNROLL $@
-3
lib/raid6/altivec.uc
··· 24 24 25 25 #include <linux/raid/pq.h> 26 26 27 - #ifdef CONFIG_ALTIVEC 28 - 29 27 #include <altivec.h> 30 28 #ifdef __KERNEL__ 31 29 # include <asm/cputable.h> 32 30 # include <asm/switch_to.h> 33 - #endif 34 31 35 32 /* 36 33 * This is the C data type to use. We use a vector of
+1 -1
lib/raid6/mmx.c
··· 16 16 * MMX implementation of RAID-6 syndrome functions 17 17 */ 18 18 19 - #if defined(__i386__) && !defined(__arch_um__) 19 + #ifdef CONFIG_X86_32 20 20 21 21 #include <linux/raid/pq.h> 22 22 #include "x86.h"
-4
lib/raid6/recov_avx2.c
··· 8 8 * of the License. 9 9 */ 10 10 11 - #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) 12 - 13 11 #if CONFIG_AS_AVX2 14 12 15 13 #include <linux/raid/pq.h> ··· 320 322 321 323 #else 322 324 #warning "your version of binutils lacks AVX2 support" 323 - #endif 324 - 325 325 #endif
-4
lib/raid6/recov_ssse3.c
··· 7 7 * of the License. 8 8 */ 9 9 10 - #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) 11 - 12 10 #include <linux/raid/pq.h> 13 11 #include "x86.h" 14 12 ··· 330 332 #endif 331 333 .priority = 1, 332 334 }; 333 - 334 - #endif
+1 -1
lib/raid6/sse1.c
··· 21 21 * worthwhile as a separate implementation. 22 22 */ 23 23 24 - #if defined(__i386__) && !defined(__arch_um__) 24 + #ifdef CONFIG_X86_32 25 25 26 26 #include <linux/raid/pq.h> 27 27 #include "x86.h"
+2 -6
lib/raid6/sse2.c
··· 17 17 * 18 18 */ 19 19 20 - #if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__) 21 - 22 20 #include <linux/raid/pq.h> 23 21 #include "x86.h" 24 22 ··· 157 159 1 /* Has cache hints */ 158 160 }; 159 161 160 - #endif 161 - 162 - #if defined(__x86_64__) && !defined(__arch_um__) 162 + #ifdef CONFIG_X86_64 163 163 164 164 /* 165 165 * Unrolled-by-4 SSE2 implementation ··· 255 259 1 /* Has cache hints */ 256 260 }; 257 261 258 - #endif 262 + #endif /* CONFIG_X86_64 */
+18 -5
lib/raid6/test/Makefile
··· 10 10 AWK = awk -f 11 11 AR = ar 12 12 RANLIB = ranlib 13 + OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o 13 14 14 15 ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/) 15 16 ifeq ($(ARCH),i386) 16 17 CFLAGS += -DCONFIG_X86_32 18 + IS_X86 = yes 17 19 endif 18 20 ifeq ($(ARCH),x86_64) 19 21 CFLAGS += -DCONFIG_X86_64 22 + IS_X86 = yes 20 23 endif 21 - CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1"| gcc -c -x assembler - &&\ 22 - rm ./-.o && echo -DCONFIG_AS_AVX2=1) 24 + 25 + ifeq ($(IS_X86),yes) 26 + OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o 27 + CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \ 28 + gcc -c -x assembler - >&/dev/null && \ 29 + rm ./-.o && echo -DCONFIG_AS_AVX2=1) 30 + else 31 + HAS_ALTIVEC := $(shell echo -e '\#include <altivec.h>\nvector int a;' |\ 32 + gcc -c -x c - >&/dev/null && \ 33 + rm ./-.o && echo yes) 34 + ifeq ($(HAS_ALTIVEC),yes) 35 + OBJS += altivec1.o altivec2.o altivec4.o altivec8.o 36 + endif 37 + endif 23 38 24 39 .c.o: 25 40 $(CC) $(CFLAGS) -c -o $@ $< ··· 47 32 48 33 all: raid6.a raid6test 49 34 50 - raid6.a: int1.o int2.o int4.o int8.o int16.o int32.o mmx.o sse1.o sse2.o avx2.o \ 51 - altivec1.o altivec2.o altivec4.o altivec8.o recov.o recov_ssse3.o recov_avx2.o algos.o \ 52 - tables.o 35 + raid6.a: $(OBJS) 53 36 rm -f $@ 54 37 $(AR) cq $@ $^ 55 38 $(RANLIB) $@