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.

powerpc: move the XOR code to lib/raid/

Move the optimized XOR into lib/raid and include it it in xor.ko instead
of always building it into the main kernel image.

Link: https://lkml.kernel.org/r/20260327061704.3707577-16-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
3f276cec 033bee3e

+74 -105
+2 -15
arch/powerpc/include/asm/xor.h
··· 8 8 #ifndef _ASM_POWERPC_XOR_H 9 9 #define _ASM_POWERPC_XOR_H 10 10 11 - #ifdef CONFIG_ALTIVEC 12 - 13 - #include <asm/cputable.h> 14 11 #include <asm/cpu_has_feature.h> 15 - #include <asm/xor_altivec.h> 16 - 17 - static struct xor_block_template xor_block_altivec = { 18 - .name = "altivec", 19 - .do_2 = xor_altivec_2, 20 - .do_3 = xor_altivec_3, 21 - .do_4 = xor_altivec_4, 22 - .do_5 = xor_altivec_5, 23 - }; 24 - #endif /* CONFIG_ALTIVEC */ 25 - 26 - /* Also try the generic routines. */ 27 12 #include <asm-generic/xor.h> 13 + 14 + extern struct xor_block_template xor_block_altivec; 28 15 29 16 #define arch_xor_init arch_xor_init 30 17 static __always_inline void __init arch_xor_init(void)
-22
arch/powerpc/include/asm/xor_altivec.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_POWERPC_XOR_ALTIVEC_H 3 - #define _ASM_POWERPC_XOR_ALTIVEC_H 4 - 5 - #ifdef CONFIG_ALTIVEC 6 - void xor_altivec_2(unsigned long bytes, unsigned long * __restrict p1, 7 - const unsigned long * __restrict p2); 8 - void xor_altivec_3(unsigned long bytes, unsigned long * __restrict p1, 9 - const unsigned long * __restrict p2, 10 - const unsigned long * __restrict p3); 11 - void xor_altivec_4(unsigned long bytes, unsigned long * __restrict p1, 12 - const unsigned long * __restrict p2, 13 - const unsigned long * __restrict p3, 14 - const unsigned long * __restrict p4); 15 - void xor_altivec_5(unsigned long bytes, unsigned long * __restrict p1, 16 - const unsigned long * __restrict p2, 17 - const unsigned long * __restrict p3, 18 - const unsigned long * __restrict p4, 19 - const unsigned long * __restrict p5); 20 - 21 - #endif 22 - #endif /* _ASM_POWERPC_XOR_ALTIVEC_H */
-5
arch/powerpc/lib/Makefile
··· 73 73 74 74 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o 75 75 76 - obj-$(CONFIG_ALTIVEC) += xor_vmx.o xor_vmx_glue.o 77 - CFLAGS_xor_vmx.o += -mhard-float -maltivec $(call cc-option,-mabi=altivec) 78 - # Enable <altivec.h> 79 - CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include) 80 - 81 76 obj-$(CONFIG_PPC64) += $(obj64-y)
arch/powerpc/lib/xor_vmx.c lib/raid/xor/powerpc/xor_vmx.c
arch/powerpc/lib/xor_vmx.h lib/raid/xor/powerpc/xor_vmx.h
-63
arch/powerpc/lib/xor_vmx_glue.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Altivec XOR operations 4 - * 5 - * Copyright 2017 IBM Corp. 6 - */ 7 - 8 - #include <linux/preempt.h> 9 - #include <linux/export.h> 10 - #include <linux/sched.h> 11 - #include <asm/switch_to.h> 12 - #include <asm/xor_altivec.h> 13 - #include "xor_vmx.h" 14 - 15 - void xor_altivec_2(unsigned long bytes, unsigned long * __restrict p1, 16 - const unsigned long * __restrict p2) 17 - { 18 - preempt_disable(); 19 - enable_kernel_altivec(); 20 - __xor_altivec_2(bytes, p1, p2); 21 - disable_kernel_altivec(); 22 - preempt_enable(); 23 - } 24 - EXPORT_SYMBOL(xor_altivec_2); 25 - 26 - void xor_altivec_3(unsigned long bytes, unsigned long * __restrict p1, 27 - const unsigned long * __restrict p2, 28 - const unsigned long * __restrict p3) 29 - { 30 - preempt_disable(); 31 - enable_kernel_altivec(); 32 - __xor_altivec_3(bytes, p1, p2, p3); 33 - disable_kernel_altivec(); 34 - preempt_enable(); 35 - } 36 - EXPORT_SYMBOL(xor_altivec_3); 37 - 38 - void xor_altivec_4(unsigned long bytes, unsigned long * __restrict p1, 39 - const unsigned long * __restrict p2, 40 - const unsigned long * __restrict p3, 41 - const unsigned long * __restrict p4) 42 - { 43 - preempt_disable(); 44 - enable_kernel_altivec(); 45 - __xor_altivec_4(bytes, p1, p2, p3, p4); 46 - disable_kernel_altivec(); 47 - preempt_enable(); 48 - } 49 - EXPORT_SYMBOL(xor_altivec_4); 50 - 51 - void xor_altivec_5(unsigned long bytes, unsigned long * __restrict p1, 52 - const unsigned long * __restrict p2, 53 - const unsigned long * __restrict p3, 54 - const unsigned long * __restrict p4, 55 - const unsigned long * __restrict p5) 56 - { 57 - preempt_disable(); 58 - enable_kernel_altivec(); 59 - __xor_altivec_5(bytes, p1, p2, p3, p4, p5); 60 - disable_kernel_altivec(); 61 - preempt_enable(); 62 - } 63 - EXPORT_SYMBOL(xor_altivec_5);
+5
lib/raid/xor/Makefile
··· 16 16 xor-$(CONFIG_ARM64) += arm64/xor-neon.o arm64/xor-neon-glue.o 17 17 xor-$(CONFIG_CPU_HAS_LSX) += loongarch/xor_simd.o 18 18 xor-$(CONFIG_CPU_HAS_LSX) += loongarch/xor_simd_glue.o 19 + xor-$(CONFIG_ALTIVEC) += powerpc/xor_vmx.o powerpc/xor_vmx_glue.o 19 20 20 21 21 22 CFLAGS_arm/xor-neon.o += $(CC_FLAGS_FPU) ··· 24 23 25 24 CFLAGS_arm64/xor-neon.o += $(CC_FLAGS_FPU) 26 25 CFLAGS_REMOVE_arm64/xor-neon.o += $(CC_FLAGS_NO_FPU) 26 + 27 + CFLAGS_powerpc/xor_vmx.o += -mhard-float -maltivec \ 28 + $(call cc-option,-mabi=altivec) \ 29 + -isystem $(shell $(CC) -print-file-name=include)
+67
lib/raid/xor/powerpc/xor_vmx_glue.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Altivec XOR operations 4 + * 5 + * Copyright 2017 IBM Corp. 6 + */ 7 + 8 + #include <linux/preempt.h> 9 + #include <linux/sched.h> 10 + #include <linux/raid/xor_impl.h> 11 + #include <asm/switch_to.h> 12 + #include <asm/xor.h> 13 + #include "xor_vmx.h" 14 + 15 + static void xor_altivec_2(unsigned long bytes, unsigned long * __restrict p1, 16 + const unsigned long * __restrict p2) 17 + { 18 + preempt_disable(); 19 + enable_kernel_altivec(); 20 + __xor_altivec_2(bytes, p1, p2); 21 + disable_kernel_altivec(); 22 + preempt_enable(); 23 + } 24 + 25 + static void xor_altivec_3(unsigned long bytes, unsigned long * __restrict p1, 26 + const unsigned long * __restrict p2, 27 + const unsigned long * __restrict p3) 28 + { 29 + preempt_disable(); 30 + enable_kernel_altivec(); 31 + __xor_altivec_3(bytes, p1, p2, p3); 32 + disable_kernel_altivec(); 33 + preempt_enable(); 34 + } 35 + 36 + static void xor_altivec_4(unsigned long bytes, unsigned long * __restrict p1, 37 + const unsigned long * __restrict p2, 38 + const unsigned long * __restrict p3, 39 + const unsigned long * __restrict p4) 40 + { 41 + preempt_disable(); 42 + enable_kernel_altivec(); 43 + __xor_altivec_4(bytes, p1, p2, p3, p4); 44 + disable_kernel_altivec(); 45 + preempt_enable(); 46 + } 47 + 48 + static void xor_altivec_5(unsigned long bytes, unsigned long * __restrict p1, 49 + const unsigned long * __restrict p2, 50 + const unsigned long * __restrict p3, 51 + const unsigned long * __restrict p4, 52 + const unsigned long * __restrict p5) 53 + { 54 + preempt_disable(); 55 + enable_kernel_altivec(); 56 + __xor_altivec_5(bytes, p1, p2, p3, p4, p5); 57 + disable_kernel_altivec(); 58 + preempt_enable(); 59 + } 60 + 61 + struct xor_block_template xor_block_altivec = { 62 + .name = "altivec", 63 + .do_2 = xor_altivec_2, 64 + .do_3 = xor_altivec_3, 65 + .do_4 = xor_altivec_4, 66 + .do_5 = xor_altivec_5, 67 + };