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 BB8AA2DB7BD for ; Thu, 20 Aug 2026 13:52:12 +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=1787233934; cv=none; b=W2Mf2RojipBSvA1PTCGQCk8sBZcGBuqfJQLzupSCoxmNV8r1P+btcrGtrQHelbi1A26B+HycFZ8dGt7B7Z2LovuTajYMfJa9b5IrlTDkEEgFLzWlcHlBq3f+a99sCYz45GZEviJX2EtDXypi3erSPZQoEN0H4raPfrZdu8cCOH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787233934; c=relaxed/simple; bh=Qr5qgk2HsoAMpQwBrv4x69IF/mj8IPQvLjZYwKXnYUM=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=dDdOJcoyiNjjAquDz5uA2KxpZ5Bp2rAspNdesWmhMDzlnOCaWu9hRXDDzn7pHLovvQ2Gi6KPiIG8hRKX+MJ3s8hv9f9hcmvvyb7apKc52xBgQkLGBtMaQpANtez2obTOqbGFkFAZ5avthjsthzz4tLDQGjcI01f4Acl7HBVYrmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V6zQLFSj; 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="V6zQLFSj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8B7E1F00A3D; Thu, 20 Aug 2026 13:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787233932; bh=zD3zgeevoRIzapGsmdBgzD2O1ClYtdB1PLKQWNbkPKo=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=V6zQLFSjbRumG/ZzB3vbDdpuLLbThnUSpsktcBfLVAyMvdcHJSH3GxKAsjeEBg/8D LPiYec1o16YRv8a6lP0W5MzGA5ef7hgPfSPcggKG9TvBUooDvUAIfJ2OgFjQkwRar7 u568h8PtyZ+7NIfcXHGNTp/ZGVXskBBIfNIpqzWAQ1vEImO0n4ZNki4JQWGfMrUwWv dZmXbbA1TtzNucXDrOV1saOmDMR4aYelK4W4V13CBuc/lCROY+DhzuzFRWxrji2/7J W+wGGPYzeI0tVTeC/0p9sWL7Tgz5MaA7wB9n9bE8kxUHZTiG4Ld266BaznqKuHrB5I DWHJxA1jmp6cw== Received: from ams-compute-02.internal (ams-compute-02.internal [10.64.2.62]) by mailfauth.ams.internal (Postfix) with ESMTP id 5B3491980052; Thu, 20 Aug 2026 09:52:10 -0400 (EDT) Received: from ams-imap-11 ([10.64.2.31]) by ams-compute-02.internal (MEProxy); Thu, 20 Aug 2026 09:52:10 -0400 X-ME-Sender: X-ME-Proxy-Cause: dmFkZTFCRl0HBk9vYQsxdiFgcQZaSulDIVtSv1i9/4ktEgUTQZk1cXT59PNxolqKjaIURt PrlEIP3DvEkM/OsJiqg/2TmQx1W6mg2nqzi+xe+QbVO2C0pfaxDDdU8nxtnlX400v+r679 +KSbEyoZ2CTHCsw3vaT+xD2R0btGAzbTpAIC8cyDlHyfu3oci4nNrH1yx/C4Ez8VbyJPCU tK+ZfABSogjQ+YVETYj/lNczXQp60Nl3uG5mGPk3Ae7mMpvK5rXHJ7J304V98Un46T+NVz wLsplI4V3Pmet6WCRV5l/xTyAFOtP0DKC7nS8IEPYH1yLgHWde0j2/rXJO63BdkpiZmcOP TjiKlq7ZT/2FFHDwKSMNno1497GnyXB7fpuSA5XN6eEZAnFpOIQTx7mmi2Ut2c/sJyH1ni au/UV0iLua0EDuMjnpqTNeT5EhE0Aw2RrElW7LbAF8PDkKOUq2iTj/g6TMbOIDdfMjZdQq HlMWeqNAfrRUoV/kYDR32EJjcyU4kEn3x0Z3+nS6zRVQPHiwAx51yn/LH8qUAeNSNzHt3s wG37OoOThOJ2J5Vbt+5r107mVwxdVR0KVjNYNSqIiQpC9REEdN/blPHwk/UNopQGTzTd+K iEAULIYJvRG19JFxMNFMvPOPtA6hbkkhCetchodaE+8955qua/+GDetp3Qtg X-ME-Proxy: Feedback-ID: ice86485a:Fastmail Received: by mailuser.ams.internal (Postfix, from userid 501) id 50AE8F80071; Thu, 20 Aug 2026 09:52:07 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 20 Aug 2026 16:50:41 +0300 From: "Ard Biesheuvel" To: "Will Deacon" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Arnd Bergmann" , "Eric Biggers" , "Daniel Borkmann" , "Catalin Marinas" , "Alexei Starovoitov" , "Oliver Upton" , "Herbert Xu" , "Marc Zyngier" Message-Id: <207397b0-07f2-467c-8419-3109a506cc7d@app.fastmail.com> In-Reply-To: References: <20260811140132.22778-1-will@kernel.org> <20260811140132.22778-7-will@kernel.org> <03208978-a825-4ae5-b47e-3dd6133ecbf0@app.fastmail.com> Subject: Re: [PATCH 06/12] arm64: assembler: Remove endianness helper macros Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, 20 Aug 2026, at 16:45, Will Deacon wrote: > On Thu, Aug 20, 2026 at 04:27:06PM +0300, Ard Biesheuvel wrote: >> >> On Thu, 20 Aug 2026, at 16:19, Will Deacon wrote: >> > On Sun, Aug 16, 2026 at 10:42:40AM +0100, Will Deacon wrote: >> >> On Tue, Aug 11, 2026 at 05:04:43PM +0200, Ard Biesheuvel wrote: >> >> > On Tue, 11 Aug 2026, at 16:01, Will Deacon wrote: >> >> > > diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S >> >> > > index 87a822e5c4ca..8951ce693552 100644 >> >> > > --- a/arch/arm64/kernel/head.S >> >> > > +++ b/arch/arm64/kernel/head.S >> >> > > @@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) >> >> > > b.ne 0f >> >> > > mrs x19, sctlr_el2 >> >> > > 0: >> >> > > -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f ) >> >> > > -CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) >> >> > > + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f >> >> > > tst x19, #SCTLR_ELx_C // Z := (C == 0) >> >> > > and x19, x19, #SCTLR_ELx_M // isolate M bit >> >> > > csel x19, xzr, x19, eq // clear x19 if Z >> >> > >> >> > There is some more code that can be removed here - see >> >> > 2ced0f30a426c7301350681f838344d5aea711e3 >> >> >> >> Good spot, thanks! I'll do some more surgery at -rc1. >> > >> > Looking at this again, I'm not sure we can remove much here. I think we >> > probably still want to force little-endian (i.e. clear the EE bit) if >> > we're entered as big-endian. I've changed the following EOR to a BIC >> > (see below), but I think that's about all we can do? >> > >> >> Well, the only case where we allow an active ID map is when doing EFI >> boot, which is guaranteed to be little-endian. Since the kernel is now >> also guaranteed to be little-endian, we should be able to simply kick >> the CPU in LE mode right at the start, no? And simply ignore the case >> of a BE bootloader entering with the MMU and caches enabled? > > Hmm, so why did we support this in the first place given that EFI is > guaranteed to be little-endian? Or was that just because we wanted to > handle the case of a big-endian kernel being loaded by EFI? > The original report is here: https://lore.kernel.org/linux-arm-kernel/Y9FZsBEu8hSVVIA8@dev-arch.thelio-3990X/ So it would probably have been sufficient at the time to just kick the CPU into LE mode - I don't remember why I added the additional logic tbh.