summaryrefslogtreecommitdiff
path: root/lib/raid/xor/loongarch/xor_simd_glue.c
blob: 7f324d924f8791c1acd735355185e5d7d46ef243 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * LoongArch SIMD XOR operations
 *
 * Copyright (C) 2023 WANG Xuerui <git@xen0n.name>
 */

#include <linux/sched.h>
#include <asm/fpu.h>
#include "xor_impl.h"
#include "xor_arch.h"
#include "xor_simd.h"

#define MAKE_XOR_GLUES(flavor)							\
DO_XOR_BLOCKS(flavor##_inner, __xor_##flavor##_2, __xor_##flavor##_3,		\
		__xor_##flavor##_4, __xor_##flavor##_5);			\
										\
static void xor_gen_##flavor(void *dest, void **srcs, unsigned int src_cnt,	\
		unsigned int bytes)						\
{										\
	kernel_fpu_begin();							\
	xor_gen_##flavor##_inner(dest, srcs, src_cnt, bytes);			\
	kernel_fpu_end();							\
}										\
										\
struct xor_block_template xor_block_##flavor = {				\
	.name		= __stringify(flavor),					\
	.xor_gen	= xor_gen_##flavor					\
}

#ifdef CONFIG_CPU_HAS_LSX
MAKE_XOR_GLUES(lsx);
#endif /* CONFIG_CPU_HAS_LSX */

#ifdef CONFIG_CPU_HAS_LASX
MAKE_XOR_GLUES(lasx);
#endif /* CONFIG_CPU_HAS_LASX */