mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
raid6: Move to more abstract 'ksimd' guard API
Move away from calling kernel_neon_begin() and kernel_neon_end() directly, and instead, use the newly introduced scoped_ksimd() API. This permits arm64 to modify the kernel mode NEON API without affecting code that is shared between ARM and arm64. Reviewed-by: Eric Biggers <ebiggers@kernel.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
@@ -8,10 +8,9 @@
|
|||||||
#include <linux/raid/pq.h>
|
#include <linux/raid/pq.h>
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <asm/neon.h>
|
#include <asm/simd.h>
|
||||||
#else
|
#else
|
||||||
#define kernel_neon_begin()
|
#define scoped_ksimd()
|
||||||
#define kernel_neon_end()
|
|
||||||
#define cpu_has_neon() (1)
|
#define cpu_has_neon() (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -32,10 +31,9 @@
|
|||||||
{ \
|
{ \
|
||||||
void raid6_neon ## _n ## _gen_syndrome_real(int, \
|
void raid6_neon ## _n ## _gen_syndrome_real(int, \
|
||||||
unsigned long, void**); \
|
unsigned long, void**); \
|
||||||
kernel_neon_begin(); \
|
scoped_ksimd() \
|
||||||
raid6_neon ## _n ## _gen_syndrome_real(disks, \
|
raid6_neon ## _n ## _gen_syndrome_real(disks, \
|
||||||
(unsigned long)bytes, ptrs); \
|
(unsigned long)bytes, ptrs); \
|
||||||
kernel_neon_end(); \
|
|
||||||
} \
|
} \
|
||||||
static void raid6_neon ## _n ## _xor_syndrome(int disks, \
|
static void raid6_neon ## _n ## _xor_syndrome(int disks, \
|
||||||
int start, int stop, \
|
int start, int stop, \
|
||||||
@@ -43,10 +41,9 @@
|
|||||||
{ \
|
{ \
|
||||||
void raid6_neon ## _n ## _xor_syndrome_real(int, \
|
void raid6_neon ## _n ## _xor_syndrome_real(int, \
|
||||||
int, int, unsigned long, void**); \
|
int, int, unsigned long, void**); \
|
||||||
kernel_neon_begin(); \
|
scoped_ksimd() \
|
||||||
raid6_neon ## _n ## _xor_syndrome_real(disks, \
|
raid6_neon ## _n ## _xor_syndrome_real(disks, \
|
||||||
start, stop, (unsigned long)bytes, ptrs); \
|
start, stop, (unsigned long)bytes, ptrs);\
|
||||||
kernel_neon_end(); \
|
|
||||||
} \
|
} \
|
||||||
struct raid6_calls const raid6_neonx ## _n = { \
|
struct raid6_calls const raid6_neonx ## _n = { \
|
||||||
raid6_neon ## _n ## _gen_syndrome, \
|
raid6_neon ## _n ## _gen_syndrome, \
|
||||||
|
|||||||
@@ -7,11 +7,10 @@
|
|||||||
#include <linux/raid/pq.h>
|
#include <linux/raid/pq.h>
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <asm/neon.h>
|
#include <asm/simd.h>
|
||||||
#include "neon.h"
|
#include "neon.h"
|
||||||
#else
|
#else
|
||||||
#define kernel_neon_begin()
|
#define scoped_ksimd()
|
||||||
#define kernel_neon_end()
|
|
||||||
#define cpu_has_neon() (1)
|
#define cpu_has_neon() (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -55,9 +54,8 @@ static void raid6_2data_recov_neon(int disks, size_t bytes, int faila,
|
|||||||
qmul = raid6_vgfmul[raid6_gfinv[raid6_gfexp[faila] ^
|
qmul = raid6_vgfmul[raid6_gfinv[raid6_gfexp[faila] ^
|
||||||
raid6_gfexp[failb]]];
|
raid6_gfexp[failb]]];
|
||||||
|
|
||||||
kernel_neon_begin();
|
scoped_ksimd()
|
||||||
__raid6_2data_recov_neon(bytes, p, q, dp, dq, pbmul, qmul);
|
__raid6_2data_recov_neon(bytes, p, q, dp, dq, pbmul, qmul);
|
||||||
kernel_neon_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void raid6_datap_recov_neon(int disks, size_t bytes, int faila,
|
static void raid6_datap_recov_neon(int disks, size_t bytes, int faila,
|
||||||
@@ -86,9 +84,8 @@ static void raid6_datap_recov_neon(int disks, size_t bytes, int faila,
|
|||||||
/* Now, pick the proper data tables */
|
/* Now, pick the proper data tables */
|
||||||
qmul = raid6_vgfmul[raid6_gfinv[raid6_gfexp[faila]]];
|
qmul = raid6_vgfmul[raid6_gfinv[raid6_gfexp[faila]]];
|
||||||
|
|
||||||
kernel_neon_begin();
|
scoped_ksimd()
|
||||||
__raid6_datap_recov_neon(bytes, p, q, dq, qmul);
|
__raid6_datap_recov_neon(bytes, p, q, dq, qmul);
|
||||||
kernel_neon_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct raid6_recov_calls raid6_recov_neon = {
|
const struct raid6_recov_calls raid6_recov_neon = {
|
||||||
|
|||||||
Reference in New Issue
Block a user