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 3BA931E9B37 for ; Thu, 20 Aug 2026 13:46:00 +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=1787233561; cv=none; b=BD8LKCf6OQGyt4UDf6IxjPzAKedJa1gQioTRUmuLDbGXsIkh7D8k+mTTGYsU4fLX0Zmc1BfCpDVu8y2dP/ruGCUa+1EriP5rRCjPMYQ/sb7AurylNoeL7WBPlptY0JGiufKx/Pu2iwJQxOe76MOsgC+9zofh23HvBXVzUQqwEwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787233561; c=relaxed/simple; bh=SjOKKAow3yx3CfF848ZeIS8bGzXcGwBK4HtlElJRE9M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VymGUEGDvWcf1BBpOrt69PQQtbWElLQY6RF1AdZeAP0jQtr4hjgvAUQjiNqn0dw81bU4gH6dOZI7N8UaEan8fbH3oE0GHoHlIMtnkrf5UV0Kx0WmKElO3G2OiOAOUmhc7awGStGGgfq44OnTYCavltligci0We2MmAoP3Aw4rJg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n4t4rPmG; 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="n4t4rPmG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9F471F00A3A; Thu, 20 Aug 2026 13:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787233560; bh=4ypmlagJXRp1A0gpAEnxYNrmttYM1r5LYQC+TwyZ97M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=n4t4rPmGo1Y4VS4jhjNh+TeFMUK+VBLHJIQ/04Ig2i5puPJZ8gZK3hdXrrub+T/pE 6XWFQC++srYlRoOXPiAispIfWyYIe0sshuP9XCSSGYp8fAb7OYmIB4BxPEfKGYkE2A HZjI648Fui04S3uhSqaSYuQxZ5ZanlifEhjudOVIbh5+iGxvU2ooxLO6oqVG9t+avQ aMKbW/zhE4GNsZOTRHsu53B9yEG1U3mG+sVUyWsxtuGuie0JeKF4CookMGXKWgTHKb BtbxQrqjndnMYul++g7YwmZduvra/gbIRgr9S+TI6aDOReAwXsE07u74u0fe/kORaQ jWuobuX0Ymvaw== Date: Thu, 20 Aug 2026 14:45:54 +0100 From: Will Deacon To: Ard Biesheuvel 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 Subject: Re: [PATCH 06/12] arm64: assembler: Remove endianness helper macros Message-ID: References: <20260811140132.22778-1-will@kernel.org> <20260811140132.22778-7-will@kernel.org> <03208978-a825-4ae5-b47e-3dd6133ecbf0@app.fastmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <03208978-a825-4ae5-b47e-3dd6133ecbf0@app.fastmail.com> 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? Will