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 6866ECDB482 for ; Wed, 18 Oct 2023 12:57:31 +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:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gB2ayUi3HbqNOHps5KpMmzEihtgSu6HVqYqp/YA199M=; b=myDK5h99eZ85Bt vIlUxhEojXHWDJJNcjAHAjQfHKRGzHUyYXA8HrhnKkGIreY7EAyy+cUzTFYZj5Cughq/oGpQK3/0Y AHuluEuSrx3t7ilXMSKGFjzxO0tgzenmYL9FUSM3RpWTm8+6QApuzPKe+C/Q0Tks28Io99/Ef+O74 YVsq1ALd05GPtTiBSFTrtXN7h7684hyf6XQ3MbhIaL9PUSHBUXJOXgNz5bvj1L7OK8Uh4iccv0X8/ LTpWRvB6mpbSJX8dqGvwejIkymNKmGGgd7EHUtbUPe6u1XqaBDzWx1D3uBcDifKkufjLG4syf14Jc 9FL1gIWEWYxn1b0TkKQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt66m-00EiXT-38; Wed, 18 Oct 2023 12:57:08 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt66j-00EiWj-1z for linux-arm-kernel@lists.infradead.org; Wed, 18 Oct 2023 12:57:07 +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 82DAE2F4; Wed, 18 Oct 2023 05:57:45 -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 809553F762; Wed, 18 Oct 2023 05:57:03 -0700 (PDT) Date: Wed, 18 Oct 2023 13:57:00 +0100 From: Mark Rutland To: Andrea della Porta Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nik.borisov@suse.com Subject: Re: [PATCH 3/4] arm64/entry-common: Make Aarch32 syscalls' availability depend on aarch32_enabled() Message-ID: References: <88bdea628a13747bff32c0c3055d6d6ef7264d96.1697614386.git.andrea.porta@suse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <88bdea628a13747bff32c0c3055d6d6ef7264d96.1697614386.git.andrea.porta@suse.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_055705_701077_385D866C X-CRM114-Status: GOOD ( 21.56 ) 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 Wed, Oct 18, 2023 at 01:13:21PM +0200, Andrea della Porta wrote: > Another major aspect of supporting running of 32bit processes is the > ability to access 32bit syscalls. Such syscalls can be invoked by > using the svc instruction. > > If Aarch32 emulation is disabled ensure that calling svc results > in the same behavior as if CONFIG_COMPAT has not been enabled (i.e. > a kernel panic). It's not "emulation" it's directly supported by the hardware. > > Signed-off-by: Andrea della Porta > --- > arch/arm64/kernel/entry-common.c | 25 ++++++++++++++++++++++--- > 1 file changed, 22 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c > index 69ff9b8c0bde..32761760d9dd 100644 > --- a/arch/arm64/kernel/entry-common.c > +++ b/arch/arm64/kernel/entry-common.c > @@ -802,6 +802,11 @@ asmlinkage void noinstr el0t_64_error_handler(struct pt_regs *regs) > } > > #ifdef CONFIG_COMPAT > +UNHANDLED(el0t, 32, sync_ni) > +UNHANDLED(el0t, 32, irq_ni) > +UNHANDLED(el0t, 32, fiq_ni) > +UNHANDLED(el0t, 32, error_ni) IRQ, FIQ, and SError are not syscalls, so the commit title is bad. > + > static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr) > { > enter_from_user_mode(regs); > @@ -821,6 +826,11 @@ static void noinstr el0_svc_compat(struct pt_regs *regs) > > asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs) > { > + if (!aarch32_enabled()) { > + el0t_32_sync_ni_handler(regs); > + return; > + } Why do we have to do this at all? If we don't have AArch32 tasks, these paths are unreachable. Why do we need to check that they aren't called? Mark. > + > unsigned long esr = read_sysreg(esr_el1); > > switch (ESR_ELx_EC(esr)) { > @@ -865,17 +875,26 @@ asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs) > > asmlinkage void noinstr el0t_32_irq_handler(struct pt_regs *regs) > { > - __el0_irq_handler_common(regs); > + if (!aarch32_enabled()) > + el0t_32_irq_ni_handler(regs); > + else > + __el0_irq_handler_common(regs); > } > > asmlinkage void noinstr el0t_32_fiq_handler(struct pt_regs *regs) > { > - __el0_fiq_handler_common(regs); > + if (!aarch32_enabled()) > + el0t_32_fiq_ni_handler(regs); > + else > + __el0_fiq_handler_common(regs); > } > > asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs) > { > - __el0_error_handler_common(regs); > + if (!aarch32_enabled()) > + el0t_32_error_ni_handler(regs); > + else > + __el0_error_handler_common(regs); > } > > bool __aarch32_enabled __ro_after_init = true; > -- > 2.35.3 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel