1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2012 Intel Corporation
4 * Copyright (C) 2017 Linaro Ltd. <ard.biesheuvel@linaro.org>
7 #include <linux/raid/pq.h>
13 #define kernel_neon_begin()
14 #define kernel_neon_end()
15 #define cpu_has_neon() (1)
18 static int raid6_has_neon(void)
20 return cpu_has_neon();
23 static void raid6_2data_recov_neon(int disks, size_t bytes, int faila,
24 int failb, void **ptrs)
27 const u8 *pbmul; /* P multiplier table for B data */
28 const u8 *qmul; /* Q multiplier table (for both) */
30 p = (u8 *)ptrs[disks - 2];
31 q = (u8 *)ptrs[disks - 1];
34 * Compute syndrome with zero for the missing data pages
35 * Use the dead data pages as temporary storage for
38 dp = (u8 *)ptrs[faila];
39 ptrs[faila] = (void *)raid6_empty_zero_page;
41 dq = (u8 *)ptrs[failb];
42 ptrs[failb] = (void *)raid6_empty_zero_page;
45 raid6_call.gen_syndrome(disks, bytes, ptrs);
47 /* Restore pointer table */
53 /* Now, pick the proper data tables */
54 pbmul = raid6_vgfmul[raid6_gfexi[failb-faila]];
55 qmul = raid6_vgfmul[raid6_gfinv[raid6_gfexp[faila] ^
59 __raid6_2data_recov_neon(bytes, p, q, dp, dq, pbmul, qmul);
63 static void raid6_datap_recov_neon(int disks, size_t bytes, int faila,
67 const u8 *qmul; /* Q multiplier table */
69 p = (u8 *)ptrs[disks - 2];
70 q = (u8 *)ptrs[disks - 1];
73 * Compute syndrome with zero for the missing data page
74 * Use the dead data page as temporary storage for delta q
76 dq = (u8 *)ptrs[faila];
77 ptrs[faila] = (void *)raid6_empty_zero_page;
80 raid6_call.gen_syndrome(disks, bytes, ptrs);
82 /* Restore pointer table */
86 /* Now, pick the proper data tables */
87 qmul = raid6_vgfmul[raid6_gfinv[raid6_gfexp[faila]]];
90 __raid6_datap_recov_neon(bytes, p, q, dq, qmul);
94 const struct raid6_recov_calls raid6_recov_neon = {
95 .data2 = raid6_2data_recov_neon,
96 .datap = raid6_datap_recov_neon,
97 .valid = raid6_has_neon,