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 34F06D1CDD9 for ; Tue, 22 Oct 2024 10:39:43 +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:Content-Transfer-Encoding: Content-Type: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=oltuq0+L3fBpXVOcqdeZdfzFBod+JYr6gligEfOB+Zo=; b=jXNx/xmSzvZBwCUAUHWuBqBZDv AnI+nhtJDRpasOC5K9bpkki1B8aEj5SZvWdEgze4aMPmEgpN+Mnn+rzx5lx/J4eX/31NLOSDIHfq8 0LaZk/EJwfDGdIaAvcn/qTbq6RmLUB4VStO2EjvmiBulHoFgery6/iv9TkV0RbK+jCyViSxEQ+Ld7 k6oyAAr+Z6SnPLHrp8U/Gy1aJKN9P/+SN8qPDRgXyq2D3IS8GNs6aCAUA/NNxjIga5Z2WPswgPN+w g2DCJzSWppw+rd0gAJ/yoiX0OsiDKV3Lmz27mCIZkI5UvYd0z4hVLSiurrHUIg9h/rrJu3eEtX2nP 7aVc670w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t3CIX-0000000AYQD-0M6Q; Tue, 22 Oct 2024 10:39:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t3CGr-0000000AXuO-30SS for linux-arm-kernel@lists.infradead.org; Tue, 22 Oct 2024 10:37:51 +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 2C293497; Tue, 22 Oct 2024 03:38:16 -0700 (PDT) Received: from [10.57.65.71] (unknown [10.57.65.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9405E3F71E; Tue, 22 Oct 2024 03:37:45 -0700 (PDT) Message-ID: <8e34dbe6-ed7c-48bb-8029-db4c35a17ad0@arm.com> Date: Tue, 22 Oct 2024 11:37:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ARM: NOMMU: Fix exc_ret for stack frame type To: Jisheng Zhang Cc: Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20241013132520.2848-1-jszhang@kernel.org> <87ba9595-6229-4a79-aa65-d76567ef708e@arm.com> Content-Language: en-GB From: Vladimir Murzin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241022_033749_832352_563014D7 X-CRM114-Status: GOOD ( 15.68 ) 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 10/15/24 01:02, Jisheng Zhang wrote: > 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 > Fair enough. Reviewed-by: Vladimir Murzin Please, upload the patch in RMK's patch system [1] [1] https://www.arm.linux.org.uk/developer/patches/ Vladimir