From patchwork Mon Dec 22 11:56:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1053 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404677; bh=7trlqVKfV2w/owHeMLCF1XqNZMIDcwK4yxYdNl62zsg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HPLnI1k1DgipMmw0PPqaRnNFu7fAUzxpu9EPvfFCizo1IUcDNX4IVbY0xgMAayqJJ Lr/d5vXvsQ+Get7mM4M6MHQNf+KaSFMNGCMg2+WhYkUg0AhcXtNT3GzZIb0ClSifpf jiJ4X8RnmVAlsjIAxvP7oTzU9DV1vu+S9kJJG9CvtVTVMPgyb6wXEmCkyyDcRIL95R PCcdwwHumSpqqTIQGNUsNPUE2JGFnohgw39M/vrHl/Mlu42r/hvtEOAxBSJtEIS/hu 4jUjFmbWrxfOPvsmNxblmENseqQM7bBFdEOzNb5DS8apRwTEahvi3z9YxgWWcVrqLv jEtujnETWYOdQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2940D64D7E for ; Mon, 22 Dec 2025 04:57:57 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id kus7R73-pCXs for ; Mon, 22 Dec 2025 04:57:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404675; bh=7trlqVKfV2w/owHeMLCF1XqNZMIDcwK4yxYdNl62zsg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Cyoo3mNvyBSzw3wX91QpSYM1on7LDcanuW6N+V1Q0MV40beyWzmaZBZNWfOUAbua/ QfV525NMAdB1k5eKy13Di5Ct5QZeNySkQ6gcX2F5nwXLr5dkykBTA6+hbB4LTtiQeu IpZ73TCSmzy+CahQQDuqQmP5nb4LbYpGbxaCmdFUSrJm6RKp8pas+7fGqRPZ8lor+s Gko05+3JOT7Szu4+KmiXffw//Bb8JUQUMlSGnbothJmmhqcaomXzqirX/C+wk17ZhU xjt2lzuvsT1rSYBF4q3mR0ETYEbWlhukfQ0gMtj4hs1JRVafL0DrNjfa2jDL0+3sOr kPgPTRBDrPoBg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2824E64C31 for ; Mon, 22 Dec 2025 04:57:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404672; bh=OOKcKZkh5Gy2rOQZrCCvapRDMXUbHBCxsXiWmXCuW/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wf0xqCVKqErKg5xHuIJyaWwfHSxRbHkykgJbqblVbzcjXH+0l2CpNOMm6ZuAST059 G6rpPxyrg+dtF+PWpmri8V/uaQlf9RWiWcpsG2b/ECLV1ty5nr9K09SP4EUlwZLWHL m44/FlBp7xGb9V9+SCMFo0EJ/Pv1C7I7xB/15xtc2AobV8Eoc5Di3roqwkKwGGAfd/ ls4t3qSmtr3EQnVFK8HIq4sKwJyolZCfXBQV80dTTe1RwhRlQJjT7hwcGAsujOfOAo uet0wXaJTeV9ciTAFajco+fjQt4FM2hzKXkMkSAUE0lv2HHzwN3FvLaTQsuwSLGEUD 3n1DI1Qj5pV5g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9052E64C31; Mon, 22 Dec 2025 04:57:52 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 7qs33F_1vTJb; Mon, 22 Dec 2025 04:57:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404672; bh=OlpkaqvjROPp1w/zOqwMfHEgV0BU7x4MT/pdXTt2WIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PF7djnkMrwHBmQrfkqNxDDhuA+hTwMxvDxf0pBCS6yoUyQSk/PG+nceyCeykuXvLT wVkgFkEwBBBcTDu2mC6cnzWrzzwa0QGGgxz9/PVbjMgiQ30tmqzIDSb1NwmbNsTOHD QvffJjNe8WoDUHq6beIn1GV8r0cm5I+Xf5ZISGFmJXBmCNkl7vblJXZr8XNXizqtCH O4n8UV6wthxP/nGVQBE+ZiZyy2GB/gSUY8RYwcnUSl8xjjzqGKFOUJSCGH8w0pUgdH YSs/dwEQH2wm4rFcdtndrkI1I7qH/C9XRthJ5YwZ/C4IjUoVWVa96M0+Qo7Eyk9tty wkQGU+SZlbDMg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 13D2B5FB5A; Mon, 22 Dec 2025 04:57:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:27 -0700 Message-ID: <20251222115639.700578-24-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7PAPOB4YLXC7BNAVQG4UGQM2XJGBAYTE X-Message-ID-Hash: 7PAPOB4YLXC7BNAVQG4UGQM2XJGBAYTE X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 23/26] linux: crc32c: Use ext4l CRC32C implementation List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Update include/linux/crc32c.h to map crc32c() and crc32c_le() macros to ext4l_crc32c(), which uses the correct Castagnoli polynomial (0x82F63B78) required for ext4 checksums. This avoids conflicts with other filesystems like btrfs that have their own crc32c() implementation. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/crc32c.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h index 44e64d3a3df..53498ce4bfb 100644 --- a/include/linux/crc32c.h +++ b/include/linux/crc32c.h @@ -1,21 +1,22 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * CRC32C definitions + * CRC32C definitions for ext4l * - * Minimal version for U-Boot ext4l - based on Linux 6.18 + * CRC32C (Castagnoli) uses polynomial 0x1EDC6F41 (bit-reflected: 0x82F63B78) + * This is different from standard CRC32 (IEEE 802.3) which uses 0x04C11DB7. + * + * ext4l provides its own implementation to avoid conflicts with other + * filesystems (e.g., btrfs) that have their own crc32c(). */ #ifndef _LINUX_CRC32C_H #define _LINUX_CRC32C_H +#include #include -#include -/* Use U-Boot's CRC32 implementation */ -static inline u32 crc32c(u32 crc, const void *address, unsigned int length) -{ - return crc32(crc, address, length); -} +u32 ext4l_crc32c(u32 crc, const void *address, unsigned int length); -#define crc32c_le(crc, p, len) crc32c(crc, p, len) +#define crc32c(crc, p, len) ext4l_crc32c(crc, p, len) +#define crc32c_le(crc, p, len) ext4l_crc32c(crc, p, len) #endif /* _LINUX_CRC32C_H */