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 9D327D18159 for ; Tue, 15 Oct 2024 00:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=c9QrJKSoSXOldSP/szMxO8AOMoFBzY9z49vH/On8s14=; b=EFHsf3xnjL8dcD2sGQTwMZAzVe Z4bnPX27G6bIPmyebrPtgADRtiqL4qdfLLL6EMetWpBd+tFSPQ73WgmzZOKLXKz6zy2wVl2gbh06S OFqUCLkrliYsO0hLo68bHph3I0Hv5OeGHzztnyoy5bTESiumfM6cPfD2QnDNtekOGMqF/QBRNI+Rl 1LSC0Dya8Cr5Mkni7nZ31UyBymaHJS1+NsZZ29NG/twxbjrskKR1SRqnU/Rr55ciUK/0iYSI1m6+Z bnnv4mSWyw3mXzjlVJFRUPiKu6EUvXupaiFFgtaI2SF2uXzF6SaYLNybWgBIVCUnPdpLNvih9KxHf aLh5ZIqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0VHJ-00000006h3b-0seT; Tue, 15 Oct 2024 00:19:09 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0VFu-00000006gxK-2AnZ for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 00:17:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 74000A429BC; Tue, 15 Oct 2024 00:17:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FFB9C4CEC3; Tue, 15 Oct 2024 00:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728951461; bh=ngIrxuzzNJwLiIU1IpPjPiIt+o+lZ0H9rQMl0ewpd7c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sFkFaldUaFxuDPfvZWF2lzyFsx8XROqUuMQTxvhXZh22+qnfkoy7cQbgxDqV8wf6f vlAtBtTsJMd66qjv7arnsZCewK0v/c04MpmUa9LGnvdyJZ/AVJn1R7qN5zp5Vd+tJx 29vRSJkbs9olZUxDpBBhyY2RaYOowcUv3Ttmksw+GVx7iZGCqtms9goi/6YNPIlttb ECgvz6Ui44dKEWyR5x9tnsvWu8J494xYrKxTKK4j2iwRYRlnDx+xHu557Vebu202hO wOIxL+Lr12kjlnLOc71pDoGaqGQ2KMMvGwnw2UIvdHGnl1MVDBdbgbbkM/ZrIKFZOS V/z6tgX1dPVcg== Date: Tue, 15 Oct 2024 08:02:19 +0800 From: Jisheng Zhang To: Vladimir Murzin Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARM: NOMMU: Fix exc_ret for stack frame type Message-ID: References: <20241013132520.2848-1-jszhang@kernel.org> <87ba9595-6229-4a79-aa65-d76567ef708e@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87ba9595-6229-4a79-aa65-d76567ef708e@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241014_171742_641301_5E06D0E1 X-CRM114-Status: GOOD ( 14.50 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 14, 2024 at 10:54:00AM +0100, Vladimir Murzin wrote: > On 10/13/24 14:25, Jisheng Zhang wrote: > > commit 72cd4064fcca ("ARM: 8830/1: NOMMU: Toggle only bits in > > EXC_RETURN we are really care of") only sets BIT[3] for Thread mode > > and BIT[2] for PSP, it leaves BIT[4] untouched. But there's such a > > case: the pre-linux env makes use of FPU then the BIT[4] in 'lr' is > > cleared, this brings an umatch issue since the NOMMU kernel doesn't > > Can pre-linux env disable FPU before passing control to kernel (which > is, as correctly pointed, doesn't know how to use FPU)? IIRC, I did a experiment like this by clearing the SCB CPACR related bits, but the stack frame type is still not correct. I searched in the armv8m arm or cortex-mN's TRM I didn't find the relation between the returned "lr" and the pre FPU usage. What's more, IMHO, kernel needs to use the correct exc_ret no matter the pre-linux env does, I.E if kernel/userspace supports FPU, then clear BIT[4]; if no, set BIT[4]. PS: this is a regression: before the commit, the have-used-fpu pre-linux env + linux nommu combination works; after the commit, it fails to execute the init due to wrong stack frame type. Thanks