From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4361EC07545 for ; Tue, 24 Oct 2023 11:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hhCJI5oUJv5MVzMFZF5nqhJDgkXLc/gknjj5YyQfBFE=; b=kXevw7B34hewvg R9Pu0h6Y4LCQWP/J7zhqt1bXECE3Mr3ZdIM61eCMaSdug8qyRxxlM6BIMkLANNTnZeUlQVI7wrFNp 7rhA8M+AFC9CbxWnBiTakHhLjX2DzhZvHkNts9C0n9eyJWF2tvXuLhda8EL/T6zXW+/aSjmeVZe23 h+RfnVwCiVJW9Wsk7FAvMTVsGShuuZk7+O3zRcbI9nAq4xKqBqw+LkICaCNbhhD9vnLO8uuYbxgNc a8MkyaUyQK2caQSXfJRDCGapIslB9QLdkR18Q/oAcUhtjk3uzCk/UE+EcPW0HI9gKMqtiZfz1/zmT +S2VtdEiq+r3N+/+NgYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvG1K-009hJE-19; Tue, 24 Oct 2023 11:56:26 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvG1G-009hHw-35 for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2023 11:56:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C653C2F4; Tue, 24 Oct 2023 04:56:56 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8B70A3F64C; Tue, 24 Oct 2023 04:56:14 -0700 (PDT) Message-ID: Date: Tue, 24 Oct 2023 12:56:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/4] arm64: Introduce aarch32_enabled() Content-Language: en-GB To: Andrea della Porta , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: nik.borisov@suse.com, arnd@arndb.de, mark.rutland@arm.com References: <1dec05cc8f54d0b85acffce69d929f13e6d81313.1698069331.git.andrea.porta@suse.com> From: Robin Murphy In-Reply-To: <1dec05cc8f54d0b85acffce69d929f13e6d81313.1698069331.git.andrea.porta@suse.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231024_045623_043738_2F4E7902 X-CRM114-Status: GOOD ( 17.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 23/10/2023 3:42 pm, Andrea della Porta wrote: > Aarch32 bit support on 64bit kernels depends on whether CONFIG_COMPAT > is selected or not. As it is a compile time option it doesn't > provide the flexibility to have distributions set their own policy for > Aarch32 support and give the user the flexibility to override it. > > As a first step introduce aarch32_enabled() which abstracts whether 32 > bit compat is turned on or off. Upcoming patches will implement > the ability to set Aarch32 compat state at boot time. Other than patch #3, which as previously mentioned should be unnecessary if the kernel correctly never starts an "unsupported" AArch32 process to begin with, what does this do that simply overriding ID_AA64PFR0_EL1.EL0 via the existing idreg-override mechanism wouldn't? Thanks, Robin. > Signed-off-by: Andrea della Porta > --- > arch/arm64/include/asm/cpufeature.h | 15 +++++++++++++++ > arch/arm64/kernel/entry-common.c | 2 ++ > 2 files changed, 17 insertions(+) > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index 396af9b9c857..1180d68daaff 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -657,6 +657,21 @@ static inline bool supports_clearbhb(int scope) > ID_AA64ISAR2_EL1_CLRBHB_SHIFT); > } > > +#ifdef CONFIG_COMPAT > +extern bool __aarch32_enabled; > + > +static inline bool aarch32_enabled(void) > +{ > + return __aarch32_enabled; > +} > +#else /* !CONFIG_COMPAT */ > + > +static inline bool aarch32_enabled(void) > +{ > + return false; > +} > +#endif > + > const struct cpumask *system_32bit_el0_cpumask(void); > DECLARE_STATIC_KEY_FALSE(arm64_mismatched_32bit_el0); > > diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c > index 0fc94207e69a..69ff9b8c0bde 100644 > --- a/arch/arm64/kernel/entry-common.c > +++ b/arch/arm64/kernel/entry-common.c > @@ -877,6 +877,8 @@ asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs) > { > __el0_error_handler_common(regs); > } > + > +bool __aarch32_enabled __ro_after_init = true; > #else /* CONFIG_COMPAT */ > UNHANDLED(el0t, 32, sync) > UNHANDLED(el0t, 32, irq) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel