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 BB667CDB465 for ; Thu, 19 Oct 2023 14:51:25 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3rz0XBB3QhT9YuH8bCmbVVr9y2l44dPD7MZR0VShykA=; b=GFsljl0eXMYm4r JzI+zvo8r8nNgKKdSi1ldntfrlciXsPnjcQ+/MN8wyOxkhje93MLjApLwkmOK7zdHgTvjZhPu0x3p DbqeIJTn5oYazfUm4Uc2D+hWP7FiJutOqXX0OrhmRKaTHKs0HCLad1CgL+xbM9+X6NHl3tcuDxhLG Smu0Hepo3vvYkGryZcEH7RDTb63KNCFyJjhA+4HumVjQHBfO0XzWNrX2NyMxt2b3T+7dqtKFp8/bd SmyxgE6JT6hUGbrC0laCGtPR7SBBfTKd+LfKxUETEmpeCFiTEkjgaeYZlzvnS+TmzT4VUaZY0ZJvY 7k+ewtXxJqqE39eMytvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtUMX-0008Aw-00; Thu, 19 Oct 2023 14:51:01 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtUMU-0008AA-1S for linux-arm-kernel@lists.infradead.org; Thu, 19 Oct 2023 14:51:00 +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 9ADC01474; Thu, 19 Oct 2023 07:51:37 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.31.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E37183F5A1; Thu, 19 Oct 2023 07:50:55 -0700 (PDT) Date: Thu, 19 Oct 2023 15:50:53 +0100 From: Mark Rutland , Will Deacon To: Andrea della Porta , Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nik.borisov@suse.com Subject: Re: [PATCH 2/4] arm64/process: Make loading of 32bit processes depend on aarch32_enabled() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231019_075058_582766_8392820C X-CRM114-Status: GOOD ( 28.94 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 19, 2023 at 04:32:27PM +0200, Andrea della Porta wrote: > On 15:27 Thu 19 Oct , Mark Rutland wrote: > > On Thu, Oct 19, 2023 at 02:38:32PM +0200, Andrea della Porta wrote: > > > On 13:52 Wed 18 Oct , Mark Rutland wrote: > > > > On Wed, Oct 18, 2023 at 01:13:20PM +0200, Andrea della Porta wrote: > > > > > Major aspect of Aarch32 emulation is the ability to load 32bit > > > > > processes. > > > > > That's currently decided (among others) by compat_elf_check_arch(). > > > > > > > > > > Make the macro use aarch32_enabled() to decide if Aarch32 compat is > > > > > enabled before loading a 32bit process. > > > > > > > > > > Signed-off-by: Andrea della Porta > > > > > > > > Why can't you make system_supports_32bit_el0() take the option into account > > > > instead? > > > > > > > > > > I may be wrong here, but it seems to me that system_supports_32bit_el0() > > > answers teh question "can this system supports compat execution?" rather than > > > "do I want this system to run any compat execution?". That's the point of > > > aarch32_enabled(), to state whether we want teh system to run A32 code or not, > > > regardless of the system supporting it (of course, if the system does not > > > support A32 in EL0, this is a no-no, but that's another story). > > > > That's what the implementation does today, but we're really using it as a "do > > we intend for 32-bit EL0 to work?" predicate, and generally the > > system_supports_${FEATURE}() helpers are affected by the combination of actual > > HW support, kernel config options, *and* kernel command line options. For > > example, system_supports_sve() is affected by both CONFIG_ARM64_SVE and the > > "arm64.nosve" command line option. > > > > Thanks, > > Mark. > > Many thanks for the explanation, then inserting aach32_enabled() in > system_supports_32bit_el0() is the way to go. I think what we should do here is clean up the way we implement system_supports_32bit_el0() such that it can be a cpucap, and have the conditions that would affect aarch32_enabled() feed into that. That way, system_supports_32bit_el0() will compile down to a single branch/nop (or elided entirely when known to be false at compile-time), and with that I think can reasonably fold the existing UNHANDLED() logic into the entry-common.c exception handlers as a simplification. The only obviously painful part is that enable_mismatched_32bit_el0() allows (mismatched) AArch32 support to be enabled after we finalize system cpucaps, as part of a late hotplug. I suspect that was implemented that way for expedience rather than because we wanted to enable mismatched AArch32 after finalizing cpucaps. Will, do you remember why we used a cpuhp callback for enabling mismatched 32-bit support? I couldn't see anything explicit in the commit message for: 2122a833316f2f3f ("arm64: Allow mismatched 32-bit EL0 support") ... and I suspect it was just easier to write that way, rather than adding more code around setup_system_capabilities() ? Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel