Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Shreesh Adiga <16567adigashreesh@gmail.com>
Cc: Ard Biesheuvel <ardb@kernel.org>, Sasha Levin <sashal@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	linux-crypto@vger.kernel.org, llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/crc: Use uint64_t for the new NEON crc64 fold constants
Date: Sun, 22 Nov 2026 11:42:00 -0800	[thread overview]
Message-ID: <20261122194200.GA2122@sol> (raw)
In-Reply-To: <20261122152900.1113961-1-sashal@kernel.org>

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@kernel.org>
> ---
> 
> 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

Thanks!

- Eric

      reply	other threads:[~2026-11-22 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 15:29 [PATCH] lib/crc: Use uint64_t for the new NEON crc64 fold constants Sasha Levin
2026-11-22 19:42 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261122194200.GA2122@sol \
    --to=ebiggers@kernel.org \
    --cc=16567adigashreesh@gmail.com \
    --cc=ardb@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=sashal@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox