lib/crc: Use uint64_t for the new NEON crc64 fold constants
Subsystems (2)
PATCH 1/1 lib/crc: Use uint64_t for the new NEON crc64 fold constants
Commit ff049836f05f ("lib/crc: Don't include <linux/types.h> in NEON intrinsics code") in mainline switched the arrays passed to vld1q_u64() to uint64_t, since u64 and the uint64_t that vld1q_u64() takes are different types on arm64 once <linux/types.h> is gone. The two arrays added by commit ef4102757fdd ("lib/crc:
Add 4-way folding in NEON crc64_nvme implementation") still use u64, so the combination fails to build with clang:
lib/crc/crc64-neon.c:66:40: error: incompatible pointer types assigning to 'const unsigned long *' from 'const u64 *' (aka 'const unsigned long long *') [-Werror,-Wincompatible-pointer-types]
Use uint64_t for them too. This builds with and without ff049836f05f.
---
crc-next is based on v7.4-rc2 and ff049836f05f went into mainline after rc3, so linux-next will hit this once it merges the two. all-next hit it already.
Tested on arm64: lib/crc/crc64-neon.o builds with clang and gcc on crc-next, and with clang on crc-next merged with mainline 4843f6873f7c. Without this patch the merged tree fails as above.
lib/crc/crc64-neon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/crc/crc64-neon.c +4 -4
@@ -11,11 +11,11 @@u64 crc64_nvme_neon (u64 crc,const u8 *p,size_t len);/* x^575 mod G, x^511 mod G */ -static const u64 fold_consts_4x_val[2 ] = {0x0c32cdb31e18a84aULL , -0x62242240ace5045aULL }; +static const uint64_t fold_consts_4x_val[2 ] = {0x0c32cdb31e18a84aULL , +0x62242240ace5045aULL };/* x^319 mod G, x^255 mod G */ -static const u64 fold_consts_2x_val[2 ] = {0xb0bc2e589204f500ULL , -0xe1e0bb9d45d7a44cULL }; +static const uint64_t fold_consts_2x_val[2 ] = {0xb0bc2e589204f500ULL , +0xe1e0bb9d45d7a44cULL };/* x^191 mod G, x^127 mod G */ static const u64 fold_consts_val[2 ] = {0xeadc41fd2ba3d420ULL ,0x21e9761e252621acULL };
base-commit: ef4102757fdd84b0b6189260780ac5faf132edc7
Signature · 1 line
2.53.0
Eric Biggers
maintainerQuoted 38 lines · Sasha Levin
Commit
ff049836f05f("lib/crc: Don't include <linux/types.h> in NEON intrinsics code") in mainline switched the arrays passed tovld1q_u64()touint64_t, since u64 and theuint64_tthatvld1q_u64()takes are different types on arm64 once <linux/types.h> is gone. The two arrays added by commitef4102757fdd("lib/crc:
Add 4-way folding in NEONcrc64_nvmeimplementation") still use u64, so the combination fails to build with clang:
lib/crc/crc64-neon.c:66:40: error: incompatible pointer types assigning to 'const unsigned long *' from 'const u64 *' (aka 'const unsigned long long *') [-Werror,-Wincompatible-pointer-types]Use
uint64_tfor them too. This builds with and withoutff049836f05f.Fixes ef4102757fdd ("lib/crc: Add 4-way folding in NEON crc64_nvme implementation")Signed-off-by Sasha Levin <[email protected]>---
crc-next is based on v7.4-rc2 and
ff049836f05fwent into mainline after rc3, so linux-next will hit this once it merges the two. all-next hit it already.Tested on arm64:
lib/crc/crc64-neon.obuilds with clang and gcc on crc-next, and with clang on crc-next merged with mainline4843f6873f7c. Without this patch the merged tree fails as above.lib/crc/crc64-neon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)lib/crc/crc64-neon.c +0
-2@@ -11,11 +11,11 @@u64 crc64_nvme_neon (u64 crc,const u8 *p,size_t len);/* x^575 mod G, x^511 mod G */ -static const u64 fold_consts_4x_val[2 ] = {0x0c32cdb31e18a84aULL , -0x62242240ace5045aULL };
lib/crc/crc64-neon.c line 21
Quoted 10 lines
lib/crc/crc64-neon.c +4
-2+static const uint64_t fold_consts_4x_val[2 ] = {0x0c32cdb31e18a84aULL , +0x62242240ace5045aULL };/* x^319 mod G, x^255 mod G */ -static const u64 fold_consts_2x_val[2 ] = {0xb0bc2e589204f500ULL , -0xe1e0bb9d45d7a44cULL }; +static const uint64_t fold_consts_2x_val[2 ] = {0xb0bc2e589204f500ULL , +0xe1e0bb9d45d7a44cULL };/* x^191 mod G, x^127 mod G */ static const u64 fold_consts_val[2 ] = {0xeadc41fd2ba3d420ULL ,0x21e9761e252621acULL };
Thanks Sasha.
I've dropped "lib/crc: Add 4-way folding in NEON crc64_nvme implementation" from crc-next temporarily.
Shreesh, could you send a new patch that folds together that patch with the two fixups for it? Then we'd get one clean patch.
lib/crc: Add 4-way folding in NEON crc64_nvme implementation lib/crc: arm: Support partial blocks in NEON crc64_nvme lib/crc: Use uint64_t for the new NEON crc64 fold constants
Thanks!
- Eric
Hi Eric,
Quoted 56 lines · Eric Biggers
Quoted 38 lines · Sasha Levin
Commit
ff049836f05f("lib/crc: Don't include <linux/types.h> in NEON intrinsics code") in mainline switched the arrays passed tovld1q_u64()touint64_t, since u64 and theuint64_tthatvld1q_u64()takes are different types on arm64 once <linux/types.h> is gone. The two arrays added by commitef4102757fdd("lib/crc:
Add 4-way folding in NEONcrc64_nvmeimplementation") still use u64, so the combination fails to build with clang:
lib/crc/crc64-neon.c:66:40: error: incompatible pointer types assigning to 'const unsigned long *' from 'const u64 *' (aka 'const unsigned long long *') [-Werror,-Wincompatible-pointer-types]Use
uint64_tfor them too. This builds with and withoutff049836f05f.Fixes ef4102757fdd ("lib/crc: Add 4-way folding in NEON crc64_nvme implementation")Signed-off-by Sasha Levin <[email protected]>---
crc-next is based on v7.4-rc2 and
ff049836f05fwent into mainline after rc3, so linux-next will hit this once it merges the two. all-next hit it already.Tested on arm64:
lib/crc/crc64-neon.obuilds with clang and gcc on crc-next, and with clang on crc-next merged with mainline4843f6873f7c. Without this patch the merged tree fails as above.lib/crc/crc64-neon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)lib/crc/crc64-neon.c +0
-2@@ -11,11 +11,11 @@u64 crc64_nvme_neon (u64 crc,const u8 *p,size_t len);/* x^575 mod G, x^511 mod G */ -static const u64 fold_consts_4x_val[2 ] = {0x0c32cdb31e18a84aULL , -0x62242240ace5045aULL };lib/crc/crc64-neon.c line 21
Quoted 10 lines
lib/crc/crc64-neon.c +4
-2+static const uint64_t fold_consts_4x_val[2 ] = {0x0c32cdb31e18a84aULL , +0x62242240ace5045aULL };/* x^319 mod G, x^255 mod G */ -static const u64 fold_consts_2x_val[2 ] = {0xb0bc2e589204f500ULL , -0xe1e0bb9d45d7a44cULL }; +static const uint64_t fold_consts_2x_val[2 ] = {0xb0bc2e589204f500ULL , +0xe1e0bb9d45d7a44cULL };/* x^191 mod G, x^127 mod G */ static const u64 fold_consts_val[2 ] = {0xeadc41fd2ba3d420ULL ,0x21e9761e252621acULL };Thanks Sasha.
I've dropped "lib/crc: Add 4-way folding in NEON
crc64_nvmeimplementation" from crc-next temporarily.
Quoted 6 lines
Shreesh, could you send a new patch that folds together that patch with the two fixups for it? Then we'd get one clean patch.
lib/crc: Add 4-way folding in NEON
crc64_nvmeimplementation lib/crc: arm: Support partial blocks in NEONcrc64_nvmelib/crc: Useuint64_tfor the new NEON crc64 fold constants
I've submitted v2 for "lib/crc: Add 4-way folding in NEON crc64_nvme implementation" which essentially contains those three listed commits (I also changed u8 to uint8_t used by vld1q_u8() in fold_partial_block for consistency).
There are some checkpatch CHECK printed about usage of uint64_t and uint8_t and to prefer the u64/u8 though, hopefully that can be tweaked to allow for neon code?
I've rebased the patch on top of 7.4-rc4 latest master so hopefully it should be sufficient here. Kindly review the v2 recently submitted and let me know if any additional changes are necessary.
Thanks,
Shreesh