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>
12 #define kernel_neon_begin()
13 #define kernel_neon_end()
14 #define cpu_has_neon() (1)
17 static int raid6_has_neon(void)
19 return cpu_has_neon();
22 void __raid6_2data_recov_neon(int bytes
, uint8_t *p
, uint8_t *q
, uint8_t *dp
,
23 uint8_t *dq
, const uint8_t *pbmul
,
26 void __raid6_datap_recov_neon(int bytes
, uint8_t *p
, uint8_t *q
, uint8_t *dq
,
29 static void raid6_2data_recov_neon(int disks
, size_t bytes
, int faila
,
30 int failb
, void **ptrs
)
33 const u8
*pbmul
; /* P multiplier table for B data */
34 const u8
*qmul
; /* Q multiplier table (for both) */
36 p
= (u8
*)ptrs
[disks
- 2];
37 q
= (u8
*)ptrs
[disks
- 1];
40 * Compute syndrome with zero for the missing data pages
41 * Use the dead data pages as temporary storage for
44 dp
= (u8
*)ptrs
[faila
];
45 ptrs
[faila
] = (void *)raid6_empty_zero_page
;
47 dq
= (u8
*)ptrs
[failb
];
48 ptrs
[failb
] = (void *)raid6_empty_zero_page
;
51 raid6_call
.gen_syndrome(disks
, bytes
, ptrs
);
53 /* Restore pointer table */
59 /* Now, pick the proper data tables */
60 pbmul
= raid6_vgfmul
[raid6_gfexi
[failb
-faila
]];
61 qmul
= raid6_vgfmul
[raid6_gfinv
[raid6_gfexp
[faila
] ^
65 __raid6_2data_recov_neon(bytes
, p
, q
, dp
, dq
, pbmul
, qmul
);
69 static void raid6_datap_recov_neon(int disks
, size_t bytes
, int faila
,
73 const u8
*qmul
; /* Q multiplier table */
75 p
= (u8
*)ptrs
[disks
- 2];
76 q
= (u8
*)ptrs
[disks
- 1];
79 * Compute syndrome with zero for the missing data page
80 * Use the dead data page as temporary storage for delta q
82 dq
= (u8
*)ptrs
[faila
];
83 ptrs
[faila
] = (void *)raid6_empty_zero_page
;
86 raid6_call
.gen_syndrome(disks
, bytes
, ptrs
);
88 /* Restore pointer table */
92 /* Now, pick the proper data tables */
93 qmul
= raid6_vgfmul
[raid6_gfinv
[raid6_gfexp
[faila
]]];
96 __raid6_datap_recov_neon(bytes
, p
, q
, dq
, qmul
);
100 const struct raid6_recov_calls raid6_recov_neon
= {
101 .data2
= raid6_2data_recov_neon
,
102 .datap
= raid6_datap_recov_neon
,
103 .valid
= raid6_has_neon
,