From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A96BC446C0C for ; Tue, 11 Aug 2026 14:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786456913; cv=none; b=q36xeBLVaHcwscYQEaYc/48d0XSI36xs/vnR8xdIwRK+ECkzE7pAMxdLmBx1E51GsgIDpp6XM77MIOhwS3Xln63fK56ZN9AFdpdbfqer33cv5Brc5g6Qu6e7DLidDb+Oph+f/4F4WCUYTWXgDqxPcfuOyTmGpr9NflWMf3fG0xw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786456913; c=relaxed/simple; bh=oDo4JwnOlJY83/zn+Y4V1QBTPSL+jHMMug/nXhzbyhk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TGmMkgBeYDgALMkK/5wRZuoeYVXQWftFuZxAUuBeiF/MyNd5tQ6r5hu4ZDruD49Dyde31akUIdZT0gS1VlpnRhxYw7S8aFJbRij63hOiidkeeRui2ECAUJDGbskEVuZb6r8dw0D6+VYziT9sQJ03PUBITICpfSSlbSLMqkBe+dQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YY0QBNa2; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YY0QBNa2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3688A1F00A3E; Tue, 11 Aug 2026 14:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786456911; bh=J1Z78TEARAUt28Nj5AzN9ZydcmZVT/uTPf+fmKTQyug=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YY0QBNa2RGTQCg84BKmW/nQ7TCLnm+59uE1OaKQVJ6/YvJvp17mKSmiNEU4pE5BmX Kk2YgyiRm8VWhJkP0qi4ohxXKFRp0d/X+Z130mMH4J2DWHkToZhnfEJy2gMMhvOAXe 71OeoAkWd3bKMVgF3hJUlsYcQ9DfH/bHimvvVyVxPiv4wrO8ZW8LNmO9TxEP/s0ALA erRE1W6ie8EXR4jltfWOZdswE42sMPC2lbpnPWyV5PdaltllgoIcd4B6fieCXNCMIl XwtDdwRJ088LufEI42ZF2e5zDFjsNWbgCrr1HiRD6ftzllfZ6ssI9hgW5jYb/6l3TK tiBeR3YucwTRw== From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Will Deacon , Arnd Bergmann , Ard Biesheuvel , Eric Biggers , Daniel Borkmann , Catalin Marinas , Alexei Starovoitov , Oliver Upton , Herbert Xu , Marc Zyngier Subject: [PATCH 04/12] arm64: lib: Assume a little-endian kernel in custom library routines Date: Tue, 11 Aug 2026 15:01:23 +0100 Message-ID: <20260811140132.22778-5-will@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260811140132.22778-1-will@kernel.org> References: <20260811140132.22778-1-will@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 5276ea17a23c ("lib/crc: arm64: Assume a little-endian kernel") removed all usage of the CPU_LE()/CPU_BE() macros from the arm64 CRC assembly now that big-endian support depends on BROKEN. Do the same for the rest of the custom arm64 library code, as well as removing all usage of the '__LITTLE_ENDIAN' macro. Signed-off-by: Will Deacon --- arch/arm64/lib/csum.c | 17 ----------------- arch/arm64/lib/memchr.S | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/arch/arm64/lib/csum.c b/arch/arm64/lib/csum.c index 2432683e48a6..75db718e5b6a 100644 --- a/arch/arm64/lib/csum.c +++ b/arch/arm64/lib/csum.c @@ -47,11 +47,7 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len) */ shift = offset * 8; data = *ptr++; -#ifdef __LITTLE_ENDIAN data = (data >> shift) << shift; -#else - data = (data << shift) >> shift; -#endif /* * Body: straightforward aligned loads from here on (the paired loads @@ -94,13 +90,8 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len) len -= 16; ptr += 2; -#ifdef __LITTLE_ENDIAN data = tmp >> 64; sum64 = accumulate(sum64, tmp); -#else - data = tmp; - sum64 = accumulate(sum64, tmp >> 64); -#endif } if (len > 0) { sum64 = accumulate(sum64, data); @@ -112,11 +103,7 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len) * preserving odd/even alignment. */ shift = len * -8; -#ifdef __LITTLE_ENDIAN data = (data << shift) >> shift; -#else - data = (data >> shift) << shift; -#endif sum64 = accumulate(sum64, data); /* Finally, folding */ @@ -140,11 +127,7 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, dst = *(const __uint128_t *)daddr->s6_addr; sum += (__force u32)htonl(len); -#ifdef __LITTLE_ENDIAN sum += (u32)proto << 24; -#else - sum += proto; -#endif src += (src >> 64) | (src << 64); dst += (dst >> 64) | (dst << 64); diff --git a/arch/arm64/lib/memchr.S b/arch/arm64/lib/memchr.S index 37a9f2a4f7f4..b14b27cb8419 100644 --- a/arch/arm64/lib/memchr.S +++ b/arch/arm64/lib/memchr.S @@ -63,7 +63,7 @@ L(byte_loop): sub srcin, srcin, #1 ret L(found_word): -CPU_LE( rev tmp, tmp) + rev tmp, tmp clz tmp, tmp sub tmp, tmp, #64 add result, srcin, tmp, asr #3 -- 2.55.0.679.g6767b8d81c-goog