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

Configure Feed

Select the types of activity you want to include in your feed.

xor: make xor.ko self-contained in lib/raid/

Move the asm/xor.h headers to lib/raid/xor/$(SRCARCH)/xor_arch.h and
include/linux/raid/xor_impl.h to lib/raid/xor/xor_impl.h so that the
xor.ko module implementation is self-contained in lib/raid/.

As this remove the asm-generic mechanism a new kconfig symbol is added to
indicate that a architecture-specific implementations exists, and
xor_arch.h should be included.

Link: https://lkml.kernel.org/r/20260327061704.3707577-22-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Tested-by: Eric Biggers <ebiggers@kernel.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Borislav Petkov (AMD)" <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chris Mason <clm@fb.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: David Sterba <dsterba@suse.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jason A. Donenfeld <jason@zx2c4.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Li Nan <linan122@huawei.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Song Liu <song@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Ted Ts'o <tytso@mit.edu>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Christoph Hellwig and committed by
Andrew Morton
e20043b4 352ebd06

+73 -109
-2
arch/alpha/include/asm/xor.h lib/raid/xor/alpha/xor_arch.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 2 3 3 #include <asm/special_insns.h> 4 - #include <asm-generic/xor.h> 5 4 6 5 extern struct xor_block_template xor_block_alpha; 7 6 extern struct xor_block_template xor_block_alpha_prefetch; ··· 9 10 * Force the use of alpha_prefetch if EV6, as it is significantly faster in the 10 11 * cold cache case. 11 12 */ 12 - #define arch_xor_init arch_xor_init 13 13 static __always_inline void __init arch_xor_init(void) 14 14 { 15 15 if (implver() == IMPLVER_EV6) {
-2
arch/arm/include/asm/xor.h lib/raid/xor/arm/xor_arch.h
··· 2 2 /* 3 3 * Copyright (C) 2001 Russell King 4 4 */ 5 - #include <asm-generic/xor.h> 6 5 #include <asm/neon.h> 7 6 8 7 extern struct xor_block_template xor_block_arm4regs; 9 8 extern struct xor_block_template xor_block_neon; 10 9 11 - #define arch_xor_init arch_xor_init 12 10 static __always_inline void __init arch_xor_init(void) 13 11 { 14 12 xor_register(&xor_block_arm4regs);
-3
arch/arm64/include/asm/xor.h lib/raid/xor/arm64/xor_arch.h
··· 3 3 * Authors: Jackie Liu <liuyun01@kylinos.cn> 4 4 * Copyright (C) 2018,Tianjin KYLIN Information Technology Co., Ltd. 5 5 */ 6 - 7 - #include <asm-generic/xor.h> 8 6 #include <asm/simd.h> 9 7 10 8 extern struct xor_block_template xor_block_neon; 11 9 extern struct xor_block_template xor_block_eor3; 12 10 13 - #define arch_xor_init arch_xor_init 14 11 static __always_inline void __init arch_xor_init(void) 15 12 { 16 13 xor_register(&xor_block_8regs);
-7
arch/loongarch/include/asm/xor.h lib/raid/xor/loongarch/xor_arch.h
··· 2 2 /* 3 3 * Copyright (C) 2023 WANG Xuerui <git@xen0n.name> 4 4 */ 5 - #ifndef _ASM_LOONGARCH_XOR_H 6 - #define _ASM_LOONGARCH_XOR_H 7 - 8 5 #include <asm/cpu-features.h> 9 6 10 7 /* ··· 12 15 * the scalar ones, maybe for errata or micro-op reasons. It may be 13 16 * appropriate to revisit this after one or two more uarch generations. 14 17 */ 15 - #include <asm-generic/xor.h> 16 18 17 19 extern struct xor_block_template xor_block_lsx; 18 20 extern struct xor_block_template xor_block_lasx; 19 21 20 - #define arch_xor_init arch_xor_init 21 22 static __always_inline void __init arch_xor_init(void) 22 23 { 23 24 xor_register(&xor_block_8regs); ··· 31 36 xor_register(&xor_block_lasx); 32 37 #endif 33 38 } 34 - 35 - #endif /* _ASM_LOONGARCH_XOR_H */
-7
arch/powerpc/include/asm/xor.h lib/raid/xor/powerpc/xor_arch.h
··· 5 5 * 6 6 * Author: Anton Blanchard <anton@au.ibm.com> 7 7 */ 8 - #ifndef _ASM_POWERPC_XOR_H 9 - #define _ASM_POWERPC_XOR_H 10 - 11 8 #include <asm/cpu_has_feature.h> 12 - #include <asm-generic/xor.h> 13 9 14 10 extern struct xor_block_template xor_block_altivec; 15 11 16 - #define arch_xor_init arch_xor_init 17 12 static __always_inline void __init arch_xor_init(void) 18 13 { 19 14 xor_register(&xor_block_8regs); ··· 20 25 xor_register(&xor_block_altivec); 21 26 #endif 22 27 } 23 - 24 - #endif /* _ASM_POWERPC_XOR_H */
-2
arch/riscv/include/asm/xor.h lib/raid/xor/riscv/xor_arch.h
··· 3 3 * Copyright (C) 2021 SiFive 4 4 */ 5 5 #include <asm/vector.h> 6 - #include <asm-generic/xor.h> 7 6 8 7 extern struct xor_block_template xor_block_rvv; 9 8 10 - #define arch_xor_init arch_xor_init 11 9 static __always_inline void __init arch_xor_init(void) 12 10 { 13 11 xor_register(&xor_block_8regs);
-6
arch/s390/include/asm/xor.h lib/raid/xor/s390/xor_arch.h
··· 5 5 * Copyright IBM Corp. 2016 6 6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 7 7 */ 8 - #ifndef _ASM_S390_XOR_H 9 - #define _ASM_S390_XOR_H 10 - 11 8 extern struct xor_block_template xor_block_xc; 12 9 13 - #define arch_xor_init arch_xor_init 14 10 static __always_inline void __init arch_xor_init(void) 15 11 { 16 12 xor_force(&xor_block_xc); 17 13 } 18 - 19 - #endif /* _ASM_S390_XOR_H */
-9
arch/sparc/include/asm/xor.h lib/raid/xor/sparc/xor_arch.h
··· 3 3 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz) 4 4 * Copyright (C) 2006 David S. Miller <davem@davemloft.net> 5 5 */ 6 - #ifndef ___ASM_SPARC_XOR_H 7 - #define ___ASM_SPARC_XOR_H 8 - 9 6 #if defined(__sparc__) && defined(__arch64__) 10 7 #include <asm/spitfire.h> 11 8 12 9 extern struct xor_block_template xor_block_VIS; 13 10 extern struct xor_block_template xor_block_niagara; 14 11 15 - #define arch_xor_init arch_xor_init 16 12 static __always_inline void __init arch_xor_init(void) 17 13 { 18 14 /* Force VIS for everything except Niagara. */ ··· 24 28 } 25 29 #else /* sparc64 */ 26 30 27 - /* For grins, also test the generic routines. */ 28 - #include <asm-generic/xor.h> 29 - 30 31 extern struct xor_block_template xor_block_SPARC; 31 32 32 - #define arch_xor_init arch_xor_init 33 33 static __always_inline void __init arch_xor_init(void) 34 34 { 35 35 xor_register(&xor_block_8regs); ··· 33 41 xor_register(&xor_block_SPARC); 34 42 } 35 43 #endif /* !sparc64 */ 36 - #endif /* ___ASM_SPARC_XOR_H */
-8
arch/um/include/asm/xor.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_UM_XOR_H 3 - #define _ASM_UM_XOR_H 4 - 5 - #include <asm/cpufeature.h> 6 - #include <../../x86/include/asm/xor.h> 7 - 8 - #endif
-7
arch/x86/include/asm/xor.h lib/raid/xor/x86/xor_arch.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - #ifndef _ASM_X86_XOR_H 3 - #define _ASM_X86_XOR_H 4 - 5 2 #include <asm/cpufeature.h> 6 - #include <asm-generic/xor.h> 7 3 8 4 extern struct xor_block_template xor_block_pII_mmx; 9 5 extern struct xor_block_template xor_block_p5_mmx; ··· 16 20 * 17 21 * 32-bit without MMX can fall back to the generic routines. 18 22 */ 19 - #define arch_xor_init arch_xor_init 20 23 static __always_inline void __init arch_xor_init(void) 21 24 { 22 25 if (boot_cpu_has(X86_FEATURE_AVX) && ··· 34 39 xor_register(&xor_block_32regs_p); 35 40 } 36 41 } 37 - 38 - #endif /* _ASM_X86_XOR_H */
-1
include/asm-generic/Kbuild
··· 65 65 mandatory-y += vga.h 66 66 mandatory-y += video.h 67 67 mandatory-y += word-at-a-time.h 68 - mandatory-y += xor.h
-11
include/asm-generic/xor.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * include/asm-generic/xor.h 4 - * 5 - * Generic optimized RAID-5 checksumming functions. 6 - */ 7 - 8 - extern struct xor_block_template xor_block_8regs; 9 - extern struct xor_block_template xor_block_32regs; 10 - extern struct xor_block_template xor_block_8regs_p; 11 - extern struct xor_block_template xor_block_32regs_p;
+6
include/linux/raid/xor_impl.h lib/raid/xor/xor_impl.h
··· 24 24 const unsigned long * __restrict); 25 25 }; 26 26 27 + /* generic implementations */ 28 + extern struct xor_block_template xor_block_8regs; 29 + extern struct xor_block_template xor_block_32regs; 30 + extern struct xor_block_template xor_block_8regs_p; 31 + extern struct xor_block_template xor_block_32regs_p; 32 + 27 33 void __init xor_register(struct xor_block_template *tmpl); 28 34 void __init xor_force(struct xor_block_template *tmpl); 29 35
+15
lib/raid/Kconfig
··· 2 2 3 3 config XOR_BLOCKS 4 4 tristate 5 + 6 + # selected by architectures that provide an optimized XOR implementation 7 + config XOR_BLOCKS_ARCH 8 + depends on XOR_BLOCKS 9 + default y if ALPHA 10 + default y if ARM 11 + default y if ARM64 12 + default y if CPU_HAS_LSX # loongarch 13 + default y if ALTIVEC # powerpc 14 + default y if RISCV_ISA_V 15 + default y if SPARC 16 + default y if S390 17 + default y if X86_32 18 + default y if X86_64 19 + bool
+6
lib/raid/xor/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 + ccflags-y += -I $(src) 4 + 3 5 obj-$(CONFIG_XOR_BLOCKS) += xor.o 4 6 5 7 xor-y += xor-core.o ··· 9 7 xor-y += xor-32regs.o 10 8 xor-y += xor-8regs-prefetch.o 11 9 xor-y += xor-32regs-prefetch.o 10 + 11 + ifeq ($(CONFIG_XOR_BLOCKS_ARCH),y) 12 + CFLAGS_xor-core.o += -I$(src)/$(SRCARCH) 13 + endif 12 14 13 15 xor-$(CONFIG_ALPHA) += alpha/xor.o 14 16 xor-$(CONFIG_ARM) += arm/xor.o
+2 -2
lib/raid/xor/alpha/xor.c
··· 2 2 /* 3 3 * Optimized XOR parity functions for alpha EV5 and EV6 4 4 */ 5 - #include <linux/raid/xor_impl.h> 6 - #include <asm/xor.h> 5 + #include "xor_impl.h" 6 + #include "xor_arch.h" 7 7 8 8 extern void 9 9 xor_alpha_2(unsigned long bytes, unsigned long * __restrict p1,
+2 -2
lib/raid/xor/arm/xor-neon-glue.c
··· 2 2 /* 3 3 * Copyright (C) 2001 Russell King 4 4 */ 5 - #include <linux/raid/xor_impl.h> 6 - #include <asm/xor.h> 5 + #include "xor_impl.h" 6 + #include "xor_arch.h" 7 7 8 8 extern struct xor_block_template const xor_block_neon_inner; 9 9
+1 -1
lib/raid/xor/arm/xor-neon.c
··· 3 3 * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org> 4 4 */ 5 5 6 - #include <linux/raid/xor_impl.h> 6 + #include "xor_impl.h" 7 7 8 8 #ifndef __ARM_NEON__ 9 9 #error You should compile this file with '-march=armv7-a -mfloat-abi=softfp -mfpu=neon'
+2 -2
lib/raid/xor/arm/xor.c
··· 2 2 /* 3 3 * Copyright (C) 2001 Russell King 4 4 */ 5 - #include <linux/raid/xor_impl.h> 6 - #include <asm/xor.h> 5 + #include "xor_impl.h" 6 + #include "xor_arch.h" 7 7 8 8 #define __XOR(a1, a2) a1 ^= a2 9 9
+2 -2
lib/raid/xor/arm64/xor-neon-glue.c
··· 4 4 * Copyright (C) 2018,Tianjin KYLIN Information Technology Co., Ltd. 5 5 */ 6 6 7 - #include <linux/raid/xor_impl.h> 8 7 #include <asm/simd.h> 9 - #include <asm/xor.h> 8 + #include "xor_impl.h" 9 + #include "xor_arch.h" 10 10 #include "xor-neon.h" 11 11 12 12 #define XOR_TEMPLATE(_name) \
+2 -2
lib/raid/xor/arm64/xor-neon.c
··· 4 4 * Copyright (C) 2018,Tianjin KYLIN Information Technology Co., Ltd. 5 5 */ 6 6 7 - #include <linux/raid/xor_impl.h> 8 7 #include <linux/cache.h> 9 8 #include <asm/neon-intrinsics.h> 10 - #include <asm/xor.h> 9 + #include "xor_impl.h" 10 + #include "xor_arch.h" 11 11 #include "xor-neon.h" 12 12 13 13 void __xor_neon_2(unsigned long bytes, unsigned long * __restrict p1,
+2 -2
lib/raid/xor/loongarch/xor_simd_glue.c
··· 6 6 */ 7 7 8 8 #include <linux/sched.h> 9 - #include <linux/raid/xor_impl.h> 10 9 #include <asm/fpu.h> 11 - #include <asm/xor.h> 10 + #include "xor_impl.h" 11 + #include "xor_arch.h" 12 12 #include "xor_simd.h" 13 13 14 14 #define MAKE_XOR_GLUE_2(flavor) \
+2 -2
lib/raid/xor/powerpc/xor_vmx_glue.c
··· 7 7 8 8 #include <linux/preempt.h> 9 9 #include <linux/sched.h> 10 - #include <linux/raid/xor_impl.h> 11 10 #include <asm/switch_to.h> 12 - #include <asm/xor.h> 11 + #include "xor_impl.h" 12 + #include "xor_arch.h" 13 13 #include "xor_vmx.h" 14 14 15 15 static void xor_altivec_2(unsigned long bytes, unsigned long * __restrict p1,
+2 -2
lib/raid/xor/riscv/xor-glue.c
··· 3 3 * Copyright (C) 2021 SiFive 4 4 */ 5 5 6 - #include <linux/raid/xor_impl.h> 7 6 #include <asm/vector.h> 8 7 #include <asm/switch_to.h> 9 8 #include <asm/asm-prototypes.h> 10 - #include <asm/xor.h> 9 + #include "xor_impl.h" 10 + #include "xor_arch.h" 11 11 12 12 static void xor_vector_2(unsigned long bytes, unsigned long *__restrict p1, 13 13 const unsigned long *__restrict p2)
+2 -2
lib/raid/xor/s390/xor.c
··· 7 7 */ 8 8 9 9 #include <linux/types.h> 10 - #include <linux/raid/xor_impl.h> 11 - #include <asm/xor.h> 10 + #include "xor_impl.h" 11 + #include "xor_arch.h" 12 12 13 13 static void xor_xc_2(unsigned long bytes, unsigned long * __restrict p1, 14 14 const unsigned long * __restrict p2)
+2 -2
lib/raid/xor/sparc/xor-sparc32.c
··· 5 5 * 6 6 * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz) 7 7 */ 8 - #include <linux/raid/xor_impl.h> 9 - #include <asm/xor.h> 8 + #include "xor_impl.h" 9 + #include "xor_arch.h" 10 10 11 11 static void 12 12 sparc_2(unsigned long bytes, unsigned long * __restrict p1,
+2 -2
lib/raid/xor/sparc/xor-sparc64-glue.c
··· 8 8 * Copyright (C) 2006 David S. Miller <davem@davemloft.net> 9 9 */ 10 10 11 - #include <linux/raid/xor_impl.h> 12 - #include <asm/xor.h> 11 + #include "xor_impl.h" 12 + #include "xor_arch.h" 13 13 14 14 void xor_vis_2(unsigned long bytes, unsigned long * __restrict p1, 15 15 const unsigned long * __restrict p2);
+2
lib/raid/xor/um/xor_arch.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #include <../x86/xor_arch.h>
+2 -2
lib/raid/xor/x86/xor-avx.c
··· 8 8 * Based on Ingo Molnar and Zach Brown's respective MMX and SSE routines 9 9 */ 10 10 #include <linux/compiler.h> 11 - #include <linux/raid/xor_impl.h> 12 11 #include <asm/fpu/api.h> 13 - #include <asm/xor.h> 12 + #include "xor_impl.h" 13 + #include "xor_arch.h" 14 14 15 15 #define BLOCK4(i) \ 16 16 BLOCK(32 * i, 0) \
+2 -2
lib/raid/xor/x86/xor-mmx.c
··· 4 4 * 5 5 * Copyright (C) 1998 Ingo Molnar. 6 6 */ 7 - #include <linux/raid/xor_impl.h> 8 7 #include <asm/fpu/api.h> 9 - #include <asm/xor.h> 8 + #include "xor_impl.h" 9 + #include "xor_arch.h" 10 10 11 11 #define LD(x, y) " movq 8*("#x")(%1), %%mm"#y" ;\n" 12 12 #define ST(x, y) " movq %%mm"#y", 8*("#x")(%1) ;\n"
+2 -2
lib/raid/xor/x86/xor-sse.c
··· 12 12 * x86-64 changes / gcc fixes from Andi Kleen. 13 13 * Copyright 2002 Andi Kleen, SuSE Labs. 14 14 */ 15 - #include <linux/raid/xor_impl.h> 16 15 #include <asm/fpu/api.h> 17 - #include <asm/xor.h> 16 + #include "xor_impl.h" 17 + #include "xor_arch.h" 18 18 19 19 #ifdef CONFIG_X86_32 20 20 /* reduce register pressure */
+1 -2
lib/raid/xor/xor-32regs-prefetch.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 #include <linux/prefetch.h> 3 - #include <linux/raid/xor_impl.h> 4 - #include <asm-generic/xor.h> 3 + #include "xor_impl.h" 5 4 6 5 static void 7 6 xor_32regs_p_2(unsigned long bytes, unsigned long * __restrict p1,
+1 -2
lib/raid/xor/xor-32regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 - #include <linux/raid/xor_impl.h> 3 - #include <asm-generic/xor.h> 2 + #include "xor_impl.h" 4 3 5 4 static void 6 5 xor_32regs_2(unsigned long bytes, unsigned long * __restrict p1,
+1 -2
lib/raid/xor/xor-8regs-prefetch.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 #include <linux/prefetch.h> 3 - #include <linux/raid/xor_impl.h> 4 - #include <asm-generic/xor.h> 3 + #include "xor_impl.h" 5 4 6 5 static void 7 6 xor_8regs_p_2(unsigned long bytes, unsigned long * __restrict p1,
+1 -2
lib/raid/xor/xor-8regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 - #include <linux/raid/xor_impl.h> 3 - #include <asm-generic/xor.h> 2 + #include "xor_impl.h" 4 3 5 4 static void 6 5 xor_8regs_2(unsigned long bytes, unsigned long * __restrict p1,
+11 -7
lib/raid/xor/xor-core.c
··· 9 9 #include <linux/module.h> 10 10 #include <linux/gfp.h> 11 11 #include <linux/raid/xor.h> 12 - #include <linux/raid/xor_impl.h> 13 12 #include <linux/jiffies.h> 14 13 #include <linux/preempt.h> 15 - #include <asm/xor.h> 14 + #include "xor_impl.h" 16 15 17 16 /* The xor routines to use. */ 18 17 static struct xor_block_template *active_template; ··· 140 141 return 0; 141 142 } 142 143 143 - static int __init xor_init(void) 144 - { 145 - #ifdef arch_xor_init 146 - arch_xor_init(); 144 + #ifdef CONFIG_XOR_BLOCKS_ARCH 145 + #include "xor_arch.h" /* $SRCARCH/xor_arch.h */ 147 146 #else 147 + static void __init arch_xor_init(void) 148 + { 148 149 xor_register(&xor_block_8regs); 149 150 xor_register(&xor_block_8regs_p); 150 151 xor_register(&xor_block_32regs); 151 152 xor_register(&xor_block_32regs_p); 152 - #endif 153 + } 154 + #endif /* CONFIG_XOR_BLOCKS_ARCH */ 155 + 156 + static int __init xor_init(void) 157 + { 158 + arch_xor_init(); 153 159 154 160 /* 155 161 * If this arch/cpu has a short-circuited selection, don't loop through