Re: [PATCH] lib/crc: Use uint64_t for the new NEON crc64 fold constants

From: Shreesh Adiga

Date: Mon Nov 23 2026 - 09:56:51 EST


Hi Eric,

On Mon, Nov 23, 2026 at 1:12 AM Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
>
> On Sun, Nov 22, 2026 at 10:29:00AM -0500, Sasha Levin wrote:
> > 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.
> >
> > Fixes: ef4102757fdd ("lib/crc: Add 4-way folding in NEON crc64_nvme implementation")
> > Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> > ---
> >
> > 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(-)
> >
> > diff --git a/lib/crc/crc64-neon.c b/lib/crc/crc64-neon.c
> > index 03b46d0abcc41..f36389789fe65 100644
> > --- a/lib/crc/crc64-neon.c
> > +++ b/lib/crc/crc64-neon.c
> > @@ -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 };
>
> 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
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