Skip to content

Commit 094bcde

Browse files
committed
Restore ASMABI and other Unify work
Make sure all SHA2 transform function has wrappers For ASMABI to work, it is required the calling convention is consistent. Signed-off-by: Joergen Lundman <lundman@lundman.net>
1 parent 620a977 commit 094bcde

File tree

5 files changed

+37
-18
lines changed

5 files changed

+37
-18
lines changed

module/icp/algs/blake3/blake3_impl.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
(defined(__x86_64) && defined(HAVE_SSE2)) || \
3535
(defined(__PPC64__) && defined(__LITTLE_ENDIAN__))
3636

37-
extern void zfs_blake3_compress_in_place_sse2(uint32_t cv[8],
37+
extern void ASMABI zfs_blake3_compress_in_place_sse2(uint32_t cv[8],
3838
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
3939
uint64_t counter, uint8_t flags);
4040

41-
extern void zfs_blake3_compress_xof_sse2(const uint32_t cv[8],
41+
extern void ASMABI zfs_blake3_compress_xof_sse2(const uint32_t cv[8],
4242
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
4343
uint64_t counter, uint8_t flags, uint8_t out[64]);
4444

45-
extern void zfs_blake3_hash_many_sse2(const uint8_t * const *inputs,
45+
extern void ASMABI zfs_blake3_hash_many_sse2(const uint8_t * const *inputs,
4646
size_t num_inputs, size_t blocks, const uint32_t key[8],
4747
uint64_t counter, boolean_t increment_counter, uint8_t flags,
4848
uint8_t flags_start, uint8_t flags_end, uint8_t *out);
@@ -100,15 +100,15 @@ const blake3_ops_t blake3_sse2_impl = {
100100
(defined(__x86_64) && defined(HAVE_SSE2)) || \
101101
(defined(__PPC64__) && defined(__LITTLE_ENDIAN__))
102102

103-
extern void zfs_blake3_compress_in_place_sse41(uint32_t cv[8],
103+
extern void ASMABI zfs_blake3_compress_in_place_sse41(uint32_t cv[8],
104104
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
105105
uint64_t counter, uint8_t flags);
106106

107-
extern void zfs_blake3_compress_xof_sse41(const uint32_t cv[8],
107+
extern void ASMABI zfs_blake3_compress_xof_sse41(const uint32_t cv[8],
108108
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
109109
uint64_t counter, uint8_t flags, uint8_t out[64]);
110110

111-
extern void zfs_blake3_hash_many_sse41(const uint8_t * const *inputs,
111+
extern void ASMABI zfs_blake3_hash_many_sse41(const uint8_t * const *inputs,
112112
size_t num_inputs, size_t blocks, const uint32_t key[8],
113113
uint64_t counter, boolean_t increment_counter, uint8_t flags,
114114
uint8_t flags_start, uint8_t flags_end, uint8_t *out);
@@ -163,7 +163,7 @@ const blake3_ops_t blake3_sse41_impl = {
163163
#endif
164164

165165
#if defined(__x86_64) && defined(HAVE_SSE4_1) && defined(HAVE_AVX2)
166-
extern void zfs_blake3_hash_many_avx2(const uint8_t * const *inputs,
166+
extern void ASMABI zfs_blake3_hash_many_avx2(const uint8_t * const *inputs,
167167
size_t num_inputs, size_t blocks, const uint32_t key[8],
168168
uint64_t counter, boolean_t increment_counter, uint8_t flags,
169169
uint8_t flags_start, uint8_t flags_end, uint8_t *out);
@@ -196,15 +196,15 @@ blake3_avx2_impl = {
196196
#endif
197197

198198
#if defined(__x86_64) && defined(HAVE_AVX512F) && defined(HAVE_AVX512VL)
199-
extern void zfs_blake3_compress_in_place_avx512(uint32_t cv[8],
199+
extern void ASMABI zfs_blake3_compress_in_place_avx512(uint32_t cv[8],
200200
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
201201
uint64_t counter, uint8_t flags);
202202

203-
extern void zfs_blake3_compress_xof_avx512(const uint32_t cv[8],
203+
extern void ASMABI zfs_blake3_compress_xof_avx512(const uint32_t cv[8],
204204
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
205205
uint64_t counter, uint8_t flags, uint8_t out[64]);
206206

207-
extern void zfs_blake3_hash_many_avx512(const uint8_t * const *inputs,
207+
extern void ASMABI zfs_blake3_hash_many_avx512(const uint8_t * const *inputs,
208208
size_t num_inputs, size_t blocks, const uint32_t key[8],
209209
uint64_t counter, boolean_t increment_counter, uint8_t flags,
210210
uint8_t flags_start, uint8_t flags_end, uint8_t *out);

module/icp/algs/sha2/sha256_impl.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
#include <sys/simd.h>
3030

3131
#include <sha2/sha2_impl.h>
32+
#include <sys/asm_linkage.h>
3233

3334
#define TF(E, N) \
34-
extern void E(uint32_t s[8], const void *, size_t); \
35+
extern void ASMABI E(uint32_t s[8], const void *, size_t); \
3536
static inline void N(uint32_t s[8], const void *d, size_t b) { \
3637
kfpu_begin(); E(s, d, b); kfpu_end(); \
3738
}
@@ -44,10 +45,19 @@ static inline boolean_t sha2_is_supported(void)
4445

4546
#if defined(__x86_64)
4647

47-
extern void zfs_sha256_transform_x64(uint32_t s[8], const void *, size_t);
48+
/* Users of ASMABI requires all calls to be from wrappers */
49+
extern void ASMABI
50+
zfs_sha256_transform_x64(uint32_t s[8], const void *, size_t);
51+
52+
static inline void
53+
tf_sha256_transform_x64(uint32_t s[8], const void *d, size_t b)
54+
{
55+
zfs_sha256_transform_x64(s, d, b);
56+
}
57+
4858
const sha256_ops_t sha256_x64_impl = {
4959
.is_supported = sha2_is_supported,
50-
.transform = zfs_sha256_transform_x64,
60+
.transform = tf_sha256_transform_x64,
5161
.name = "x64"
5262
};
5363

module/icp/algs/sha2/sha512_impl.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
#include <sys/simd.h>
3030

3131
#include <sha2/sha2_impl.h>
32+
#include <sys/asm_linkage.h>
3233

3334
#define TF(E, N) \
34-
extern void E(uint64_t s[8], const void *, size_t); \
35+
extern void ASMABI E(uint64_t s[8], const void *, size_t); \
3536
static inline void N(uint64_t s[8], const void *d, size_t b) { \
3637
kfpu_begin(); E(s, d, b); kfpu_end(); \
3738
}
@@ -44,10 +45,18 @@ static inline boolean_t sha2_is_supported(void)
4445

4546
#if defined(__x86_64)
4647

47-
extern void zfs_sha512_transform_x64(uint64_t s[8], const void *, size_t);
48+
/* Users of ASMABI requires all calls to be from wrappers */
49+
extern void ASMABI
50+
zfs_sha512_transform_x64(uint32_t s[8], const void *, size_t);
51+
52+
static inline void
53+
tf_sha512_transform_x64(uint32_t s[8], const void *d, size_t b)
54+
{
55+
zfs_sha512_transform_x64(s, d, b);
56+
}
4857
const sha512_ops_t sha512_x64_impl = {
4958
.is_supported = sha2_is_supported,
50-
.transform = zfs_sha512_transform_x64,
59+
.transform = tf_sha512_transform_x64,
5160
.name = "x64"
5261
};
5362

module/icp/asm-x86_64/sha2/sha256-x86_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
SECTION_STATIC
2828

2929
.align 64
30-
.type K256,@object
30+
SET_OBJ(K256)
3131
K256:
3232
.long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
3333
.long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5

module/icp/asm-x86_64/sha2/sha512-x86_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
SECTION_STATIC
2828

2929
.align 64
30-
.type K512,@object
30+
SET_OBJ(K512)
3131
K512:
3232
.quad 0x428a2f98d728ae22,0x7137449123ef65cd
3333
.quad 0x428a2f98d728ae22,0x7137449123ef65cd

0 commit comments

Comments
 (0)