]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xor: make xor.ko self-contained in lib/raid/
authorChristoph Hellwig <hch@lst.de>
Fri, 27 Mar 2026 06:16:53 +0000 (07:16 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 3 Apr 2026 06:36:20 +0000 (23:36 -0700)
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>
36 files changed:
arch/um/include/asm/xor.h [deleted file]
include/asm-generic/Kbuild
include/asm-generic/xor.h [deleted file]
lib/raid/Kconfig
lib/raid/xor/Makefile
lib/raid/xor/alpha/xor.c
lib/raid/xor/alpha/xor_arch.h [moved from arch/alpha/include/asm/xor.h with 90% similarity]
lib/raid/xor/arm/xor-neon-glue.c
lib/raid/xor/arm/xor-neon.c
lib/raid/xor/arm/xor.c
lib/raid/xor/arm/xor_arch.h [moved from arch/arm/include/asm/xor.h with 87% similarity]
lib/raid/xor/arm64/xor-neon-glue.c
lib/raid/xor/arm64/xor-neon.c
lib/raid/xor/arm64/xor_arch.h [moved from arch/arm64/include/asm/xor.h with 89% similarity]
lib/raid/xor/loongarch/xor_arch.h [moved from arch/loongarch/include/asm/xor.h with 85% similarity]
lib/raid/xor/loongarch/xor_simd_glue.c
lib/raid/xor/powerpc/xor_arch.h [moved from arch/powerpc/include/asm/xor.h with 77% similarity]
lib/raid/xor/powerpc/xor_vmx_glue.c
lib/raid/xor/riscv/xor-glue.c
lib/raid/xor/riscv/xor_arch.h [moved from arch/riscv/include/asm/xor.h with 84% similarity]
lib/raid/xor/s390/xor.c
lib/raid/xor/s390/xor_arch.h [moved from arch/s390/include/asm/xor.h with 71% similarity]
lib/raid/xor/sparc/xor-sparc32.c
lib/raid/xor/sparc/xor-sparc64-glue.c
lib/raid/xor/sparc/xor_arch.h [moved from arch/sparc/include/asm/xor.h with 81% similarity]
lib/raid/xor/um/xor_arch.h [new file with mode: 0644]
lib/raid/xor/x86/xor-avx.c
lib/raid/xor/x86/xor-mmx.c
lib/raid/xor/x86/xor-sse.c
lib/raid/xor/x86/xor_arch.h [moved from arch/x86/include/asm/xor.h with 89% similarity]
lib/raid/xor/xor-32regs-prefetch.c
lib/raid/xor/xor-32regs.c
lib/raid/xor/xor-8regs-prefetch.c
lib/raid/xor/xor-8regs.c
lib/raid/xor/xor-core.c
lib/raid/xor/xor_impl.h [moved from include/linux/raid/xor_impl.h with 80% similarity]

diff --git a/arch/um/include/asm/xor.h b/arch/um/include/asm/xor.h
deleted file mode 100644 (file)
index 99e5c7e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_UM_XOR_H
-#define _ASM_UM_XOR_H
-
-#include <asm/cpufeature.h>
-#include <../../x86/include/asm/xor.h>
-
-#endif
index 9aff61e7b8f27ce8993d83e7a11a045c6f9b13b1..2c53a1e0b7604182c955e26241f43d43a4f0c66a 100644 (file)
@@ -65,4 +65,3 @@ mandatory-y += vermagic.h
 mandatory-y += vga.h
 mandatory-y += video.h
 mandatory-y += word-at-a-time.h
-mandatory-y += xor.h
diff --git a/include/asm-generic/xor.h b/include/asm-generic/xor.h
deleted file mode 100644 (file)
index fc151fd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * include/asm-generic/xor.h
- *
- * Generic optimized RAID-5 checksumming functions.
- */
-
-extern struct xor_block_template xor_block_8regs;
-extern struct xor_block_template xor_block_32regs;
-extern struct xor_block_template xor_block_8regs_p;
-extern struct xor_block_template xor_block_32regs_p;
index 01b73a1c303feeaf2b914ad3b747f33ddae4d26c..81cb3f9c0a7bb83a19142d9d1dae98da17ba4835 100644 (file)
@@ -2,3 +2,18 @@
 
 config XOR_BLOCKS
        tristate
+
+# selected by architectures that provide an optimized XOR implementation
+config XOR_BLOCKS_ARCH
+       depends on XOR_BLOCKS
+       default y if ALPHA
+       default y if ARM
+       default y if ARM64
+       default y if CPU_HAS_LSX                # loongarch
+       default y if ALTIVEC                    # powerpc
+       default y if RISCV_ISA_V
+       default y if SPARC
+       default y if S390
+       default y if X86_32
+       default y if X86_64
+       bool
index 05aca96041b3acc1215d87907a661a6fc73c0e8d..df55823c4d827cd4c28bc4cb6b2bbf4f13b08c9e 100644 (file)
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
+ccflags-y                      += -I $(src)
+
 obj-$(CONFIG_XOR_BLOCKS)       += xor.o
 
 xor-y                          += xor-core.o
@@ -8,6 +10,10 @@ xor-y                         += xor-32regs.o
 xor-y                          += xor-8regs-prefetch.o
 xor-y                          += xor-32regs-prefetch.o
 
+ifeq ($(CONFIG_XOR_BLOCKS_ARCH),y)
+CFLAGS_xor-core.o              += -I$(src)/$(SRCARCH)
+endif
+
 xor-$(CONFIG_ALPHA)            += alpha/xor.o
 xor-$(CONFIG_ARM)              += arm/xor.o
 ifeq ($(CONFIG_ARM),y)
index 0964ac42060405f075cb4378eea5ddbcce92ed58..90694cc47395b9ba5ad34e551bea0e52f70d4c7f 100644 (file)
@@ -2,8 +2,8 @@
 /*
  * Optimized XOR parity functions for alpha EV5 and EV6
  */
-#include <linux/raid/xor_impl.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 extern void
 xor_alpha_2(unsigned long bytes, unsigned long * __restrict p1,
similarity index 90%
rename from arch/alpha/include/asm/xor.h
rename to lib/raid/xor/alpha/xor_arch.h
index e517be577a09ffd231599d0e906148513a1f8eb4..0dcfea578a488a040228c5a9391c3163e3dcf0db 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include <asm/special_insns.h>
-#include <asm-generic/xor.h>
 
 extern struct xor_block_template xor_block_alpha;
 extern struct xor_block_template xor_block_alpha_prefetch;
@@ -10,7 +9,6 @@ extern struct xor_block_template xor_block_alpha_prefetch;
  * Force the use of alpha_prefetch if EV6, as it is significantly faster in the
  * cold cache case.
  */
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        if (implver() == IMPLVER_EV6) {
index c7b162b383a25b93102cf030374bcb7b6dda2a6e..7afd6294464bc559979db7a67aadc9765f6aa34b 100644 (file)
@@ -2,8 +2,8 @@
 /*
  *  Copyright (C) 2001 Russell King
  */
-#include <linux/raid/xor_impl.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 extern struct xor_block_template const xor_block_neon_inner;
 
index c9d4378b0f0ec20ca3fa28ac0ec57963ab531703..806a42c5952c505289951c267510a0bd00c93e03 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  */
 
-#include <linux/raid/xor_impl.h>
+#include "xor_impl.h"
 
 #ifndef __ARM_NEON__
 #error You should compile this file with '-march=armv7-a -mfloat-abi=softfp -mfpu=neon'
index 2263341dbbcdf900834cfdf411609ea3020f219f..5bd5f048bbe9ea1d39d2eb3175b31eb19d9b75e3 100644 (file)
@@ -2,8 +2,8 @@
 /*
  *  Copyright (C) 2001 Russell King
  */
-#include <linux/raid/xor_impl.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 #define __XOR(a1, a2) a1 ^= a2
 
similarity index 87%
rename from arch/arm/include/asm/xor.h
rename to lib/raid/xor/arm/xor_arch.h
index 989c55872ef6a54245a2eb1f336df77beba955cc..5a7eedb48fbb94ff1fb036a4416559c99a955371 100644 (file)
@@ -2,13 +2,11 @@
 /*
  *  Copyright (C) 2001 Russell King
  */
-#include <asm-generic/xor.h>
 #include <asm/neon.h>
 
 extern struct xor_block_template xor_block_arm4regs;
 extern struct xor_block_template xor_block_neon;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        xor_register(&xor_block_arm4regs);
index 08c3e3573388d4003ad2c676f5cca85011830354..3db0a318cf5bb509197eec925119a50b5743b54e 100644 (file)
@@ -4,9 +4,9 @@
  * Copyright (C) 2018,Tianjin KYLIN Information Technology Co., Ltd.
  */
 
-#include <linux/raid/xor_impl.h>
 #include <asm/simd.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 #include "xor-neon.h"
 
 #define XOR_TEMPLATE(_name)                                            \
index 61194c292917e5756c6e7f43670440feabafa9da..61f00c4fee495244f38ad4ff5e809d3b1304de56 100644 (file)
@@ -4,10 +4,10 @@
  * Copyright (C) 2018,Tianjin KYLIN Information Technology Co., Ltd.
  */
 
-#include <linux/raid/xor_impl.h>
 #include <linux/cache.h>
 #include <asm/neon-intrinsics.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 #include "xor-neon.h"
 
 void __xor_neon_2(unsigned long bytes, unsigned long * __restrict p1,
similarity index 89%
rename from arch/arm64/include/asm/xor.h
rename to lib/raid/xor/arm64/xor_arch.h
index 4782c760bcac22a47996802267e2535904c89dbd..5dbb40319501b7d957ee4c75612fd16304964b13 100644 (file)
@@ -3,14 +3,11 @@
  * Authors: Jackie Liu <liuyun01@kylinos.cn>
  * Copyright (C) 2018,Tianjin KYLIN Information Technology Co., Ltd.
  */
-
-#include <asm-generic/xor.h>
 #include <asm/simd.h>
 
 extern struct xor_block_template xor_block_neon;
 extern struct xor_block_template xor_block_eor3;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        xor_register(&xor_block_8regs);
similarity index 85%
rename from arch/loongarch/include/asm/xor.h
rename to lib/raid/xor/loongarch/xor_arch.h
index 7e32f72f8b036d5a70e0e0fd168fcac40d5075f6..fe5e8244fd0ebd0d38b384844b41eaf8a9dccb5c 100644 (file)
@@ -2,9 +2,6 @@
 /*
  * Copyright (C) 2023 WANG Xuerui <git@xen0n.name>
  */
-#ifndef _ASM_LOONGARCH_XOR_H
-#define _ASM_LOONGARCH_XOR_H
-
 #include <asm/cpu-features.h>
 
 /*
  * the scalar ones, maybe for errata or micro-op reasons. It may be
  * appropriate to revisit this after one or two more uarch generations.
  */
-#include <asm-generic/xor.h>
 
 extern struct xor_block_template xor_block_lsx;
 extern struct xor_block_template xor_block_lasx;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        xor_register(&xor_block_8regs);
@@ -36,5 +31,3 @@ static __always_inline void __init arch_xor_init(void)
                xor_register(&xor_block_lasx);
 #endif
 }
-
-#endif /* _ASM_LOONGARCH_XOR_H */
index 11fa3b47ba83a3af796da061e7d669f33563b67c..b387aa0213b4710d47253f333eb8fff0fcd89d76 100644 (file)
@@ -6,9 +6,9 @@
  */
 
 #include <linux/sched.h>
-#include <linux/raid/xor_impl.h>
 #include <asm/fpu.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 #include "xor_simd.h"
 
 #define MAKE_XOR_GLUE_2(flavor)                                                        \
similarity index 77%
rename from arch/powerpc/include/asm/xor.h
rename to lib/raid/xor/powerpc/xor_arch.h
index 3293ac87181c331d9b38fa2397053ce607c1b07d..3b00a4a2fd67cc73a5d2ccf9316922a3d99a76aa 100644 (file)
@@ -5,15 +5,10 @@
  *
  * Author: Anton Blanchard <anton@au.ibm.com>
  */
-#ifndef _ASM_POWERPC_XOR_H
-#define _ASM_POWERPC_XOR_H
-
 #include <asm/cpu_has_feature.h>
-#include <asm-generic/xor.h>
 
 extern struct xor_block_template xor_block_altivec;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        xor_register(&xor_block_8regs);
@@ -25,5 +20,3 @@ static __always_inline void __init arch_xor_init(void)
                xor_register(&xor_block_altivec);
 #endif
 }
-
-#endif /* _ASM_POWERPC_XOR_H */
index c41e38340700426fea89293536245867af3c9c4c..56e99ddfb64f61dd421840ef6229e970858b9a29 100644 (file)
@@ -7,9 +7,9 @@
 
 #include <linux/preempt.h>
 #include <linux/sched.h>
-#include <linux/raid/xor_impl.h>
 #include <asm/switch_to.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 #include "xor_vmx.h"
 
 static void xor_altivec_2(unsigned long bytes, unsigned long * __restrict p1,
index 11666a4b6b6872668227dcfbe74497389a9c0db6..060e5f22ebcce1e70b6d7c289a64aa75745f3b27 100644 (file)
@@ -3,11 +3,11 @@
  * Copyright (C) 2021 SiFive
  */
 
-#include <linux/raid/xor_impl.h>
 #include <asm/vector.h>
 #include <asm/switch_to.h>
 #include <asm/asm-prototypes.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 static void xor_vector_2(unsigned long bytes, unsigned long *__restrict p1,
                         const unsigned long *__restrict p2)
similarity index 84%
rename from arch/riscv/include/asm/xor.h
rename to lib/raid/xor/riscv/xor_arch.h
index 614d9209d078238f63907d5cae625d6126d3cb8a..9240857d760b26dc7f67a8b30306d580d16289c2 100644 (file)
@@ -3,11 +3,9 @@
  * Copyright (C) 2021 SiFive
  */
 #include <asm/vector.h>
-#include <asm-generic/xor.h>
 
 extern struct xor_block_template xor_block_rvv;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        xor_register(&xor_block_8regs);
index acbd268adfc8df89c9b8e268e1f403e910260922..c28cb56fec92bb3ea0fa024d25b2cd5fc9f22dd3 100644 (file)
@@ -7,8 +7,8 @@
  */
 
 #include <linux/types.h>
-#include <linux/raid/xor_impl.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 static void xor_xc_2(unsigned long bytes, unsigned long * __restrict p1,
                     const unsigned long * __restrict p2)
similarity index 71%
rename from arch/s390/include/asm/xor.h
rename to lib/raid/xor/s390/xor_arch.h
index 4e2233f64da98df4a8303e6dc9455b5175ae8793..4a233ed2b97a6a30226e3157d8cc5810173d3d3e 100644 (file)
@@ -5,15 +5,9 @@
  * Copyright IBM Corp. 2016
  * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
  */
-#ifndef _ASM_S390_XOR_H
-#define _ASM_S390_XOR_H
-
 extern struct xor_block_template xor_block_xc;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        xor_force(&xor_block_xc);
 }
-
-#endif /* _ASM_S390_XOR_H */
index b65a75a6e59d8fe3e1c72fad789593220b506c28..307c4a84f535d4607cac89e74ca55e33f7a9b943 100644 (file)
@@ -5,8 +5,8 @@
  *
  * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz)
  */
-#include <linux/raid/xor_impl.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 static void
 sparc_2(unsigned long bytes, unsigned long * __restrict p1,
index 3c67c8c3a0e821f2b02d9b0e781b1bbd77981aa2..5f90c2460b54cff5ce16f86d130db3f89c2d8a4b 100644 (file)
@@ -8,8 +8,8 @@
  * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
  */
 
-#include <linux/raid/xor_impl.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 void xor_vis_2(unsigned long bytes, unsigned long * __restrict p1,
               const unsigned long * __restrict p2);
similarity index 81%
rename from arch/sparc/include/asm/xor.h
rename to lib/raid/xor/sparc/xor_arch.h
index f923b009fc24fa7a255c403d675d8644141d3dec..af288abe4e917638ad0462fa73829e895a33bc0f 100644 (file)
@@ -3,16 +3,12 @@
  * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
  * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
  */
-#ifndef ___ASM_SPARC_XOR_H
-#define ___ASM_SPARC_XOR_H
-
 #if defined(__sparc__) && defined(__arch64__)
 #include <asm/spitfire.h>
 
 extern struct xor_block_template xor_block_VIS;
 extern struct xor_block_template xor_block_niagara;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        /* Force VIS for everything except Niagara.  */
@@ -28,12 +24,8 @@ static __always_inline void __init arch_xor_init(void)
 }
 #else /* sparc64 */
 
-/* For grins, also test the generic routines.  */
-#include <asm-generic/xor.h>
-
 extern struct xor_block_template xor_block_SPARC;
 
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        xor_register(&xor_block_8regs);
@@ -41,4 +33,3 @@ static __always_inline void __init arch_xor_init(void)
        xor_register(&xor_block_SPARC);
 }
 #endif /* !sparc64 */
-#endif /* ___ASM_SPARC_XOR_H */
diff --git a/lib/raid/xor/um/xor_arch.h b/lib/raid/xor/um/xor_arch.h
new file mode 100644 (file)
index 0000000..a33e57a
--- /dev/null
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <../x86/xor_arch.h>
index b49cb5199e709ed110a1704723ed438ff6b4f4bd..d411efa1ff4355c06273d800d40ff3c64480a152 100644 (file)
@@ -8,9 +8,9 @@
  * Based on Ingo Molnar and Zach Brown's respective MMX and SSE routines
  */
 #include <linux/compiler.h>
-#include <linux/raid/xor_impl.h>
 #include <asm/fpu/api.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 #define BLOCK4(i) \
                BLOCK(32 * i, 0) \
index cf0fafea33b72b9c3228296b72d4b8c089b0dcef..e48c58f92874089f19f34745d34bfc1adb93aba4 100644 (file)
@@ -4,9 +4,9 @@
  *
  * Copyright (C) 1998 Ingo Molnar.
  */
-#include <linux/raid/xor_impl.h>
 #include <asm/fpu/api.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 #define LD(x, y)       "       movq   8*("#x")(%1), %%mm"#y"   ;\n"
 #define ST(x, y)       "       movq %%mm"#y",   8*("#x")(%1)   ;\n"
index 0e727ced8b0051850b2ab33f87cb43468929d9f6..5993ed688c15539fcb241a96fe2d7af83d0cbf59 100644 (file)
@@ -12,9 +12,9 @@
  * x86-64 changes / gcc fixes from Andi Kleen.
  * Copyright 2002 Andi Kleen, SuSE Labs.
  */
-#include <linux/raid/xor_impl.h>
 #include <asm/fpu/api.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
+#include "xor_arch.h"
 
 #ifdef CONFIG_X86_32
 /* reduce register pressure */
similarity index 89%
rename from arch/x86/include/asm/xor.h
rename to lib/raid/xor/x86/xor_arch.h
index d1aab8275908e75fe865f3ea6b6cd849282d7824..99fe85a213c669d8ddea3225a63756d12550d25f 100644 (file)
@@ -1,9 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
-#ifndef _ASM_X86_XOR_H
-#define _ASM_X86_XOR_H
-
 #include <asm/cpufeature.h>
-#include <asm-generic/xor.h>
 
 extern struct xor_block_template xor_block_pII_mmx;
 extern struct xor_block_template xor_block_p5_mmx;
@@ -20,7 +16,6 @@ extern struct xor_block_template xor_block_avx;
  *
  * 32-bit without MMX can fall back to the generic routines.
  */
-#define arch_xor_init arch_xor_init
 static __always_inline void __init arch_xor_init(void)
 {
        if (boot_cpu_has(X86_FEATURE_AVX) &&
@@ -39,5 +34,3 @@ static __always_inline void __init arch_xor_init(void)
                xor_register(&xor_block_32regs_p);
        }
 }
-
-#endif /* _ASM_X86_XOR_H */
index 8666c287f7775bd0c7d89402c288eeecf5322b01..2856a8e50cb840847d8b54865035c919f899c479 100644 (file)
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 #include <linux/prefetch.h>
-#include <linux/raid/xor_impl.h>
-#include <asm-generic/xor.h>
+#include "xor_impl.h"
 
 static void
 xor_32regs_p_2(unsigned long bytes, unsigned long * __restrict p1,
index 58d4fac43eb44cf730f2eba45b184c84f27ae2dd..cc44d64032fa77cad16de120f01aeda9a130d390 100644 (file)
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
-#include <linux/raid/xor_impl.h>
-#include <asm-generic/xor.h>
+#include "xor_impl.h"
 
 static void
 xor_32regs_2(unsigned long bytes, unsigned long * __restrict p1,
index 67061e35a0a67f8ade54e33c4ce0511120cd6754..1d53aec50d27b6b59e32d8ddd6585c09f7d22d56 100644 (file)
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 #include <linux/prefetch.h>
-#include <linux/raid/xor_impl.h>
-#include <asm-generic/xor.h>
+#include "xor_impl.h"
 
 static void
 xor_8regs_p_2(unsigned long bytes, unsigned long * __restrict p1,
index 769f796ab2cf4bd30057ff6d23cdf2dc53ca6f64..72a44e898c5513739a980945fe72d9bf5de03e3a 100644 (file)
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
-#include <linux/raid/xor_impl.h>
-#include <asm-generic/xor.h>
+#include "xor_impl.h"
 
 static void
 xor_8regs_2(unsigned long bytes, unsigned long * __restrict p1,
index 93608b5fece9e3f9e959c619889af36ffd536ec2..de1d2899490a04818471795020079c778119480f 100644 (file)
@@ -9,10 +9,9 @@
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <linux/raid/xor.h>
-#include <linux/raid/xor_impl.h>
 #include <linux/jiffies.h>
 #include <linux/preempt.h>
-#include <asm/xor.h>
+#include "xor_impl.h"
 
 /* The xor routines to use.  */
 static struct xor_block_template *active_template;
@@ -141,16 +140,21 @@ static int __init calibrate_xor_blocks(void)
        return 0;
 }
 
-static int __init xor_init(void)
-{
-#ifdef arch_xor_init
-       arch_xor_init();
+#ifdef CONFIG_XOR_BLOCKS_ARCH
+#include "xor_arch.h" /* $SRCARCH/xor_arch.h */
 #else
+static void __init arch_xor_init(void)
+{
        xor_register(&xor_block_8regs);
        xor_register(&xor_block_8regs_p);
        xor_register(&xor_block_32regs);
        xor_register(&xor_block_32regs_p);
-#endif
+}
+#endif /* CONFIG_XOR_BLOCKS_ARCH */
+
+static int __init xor_init(void)
+{
+       arch_xor_init();
 
        /*
         * If this arch/cpu has a short-circuited selection, don't loop through
similarity index 80%
rename from include/linux/raid/xor_impl.h
rename to lib/raid/xor/xor_impl.h
index 6ed4c445ab24ce65f7db56c0f2ddc88347b3731b..44b6c99e2093e18b838f79dbf0f75af17f6faa5c 100644 (file)
@@ -24,6 +24,12 @@ struct xor_block_template {
                     const unsigned long * __restrict);
 };
 
+/* generic implementations */
+extern struct xor_block_template xor_block_8regs;
+extern struct xor_block_template xor_block_32regs;
+extern struct xor_block_template xor_block_8regs_p;
+extern struct xor_block_template xor_block_32regs_p;
+
 void __init xor_register(struct xor_block_template *tmpl);
 void __init xor_force(struct xor_block_template *tmpl);