| Message ID | 598191cd2102633b80b8890af6c8b3292fb76242.15545c56.8705.442f.b574.8164d38a1edb@feishu.cn |
|---|---|
| State | New |
| Headers | show
Return-Path:
<opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@legolas.ozlabs.org
Authentication-Results: legolas.ozlabs.org;
dkim=pass (2048-bit key;
secure) header.d=lists.infradead.org header.i=@lists.infradead.org
header.a=rsa-sha256 header.s=bombadil.20210309 header.b=StEOtcBR;
dkim=fail reason="signature verification failed" (2048-bit key;
unprotected) header.d=spacemit.com header.i=@spacemit.com header.a=rsa-sha256
header.s=feishu2303021642 header.b=AEA0z/y6;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org
(client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;
envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;
receiver=patchwork.ozlabs.org)
Received: from bombadil.infradead.org (bombadil.infradead.org
[IPv6:2607:7c80:54:3::133])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4hJxdV493Sz1xtl
for <incoming@patchwork.ozlabs.org>; Tue, 11 Aug 2026 13:17:50 +1000 (AEST)
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:Message-Id:Mime-Version:Subject:Cc:To:
Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:
List-Owner; bh=Q7VVTVmNkSA/fvwY66r52JWrjG9TPFEKDyDgEIE3uNk=; b=StEOtcBREQ/aQ+
ZLrVmxehuYw1FzIWWiJgx1G82mFjJRpdVNdCkhcFvc06WM3vOXsRJR4d9EqtR/gVvaZIOIspS9QzD
QlT0vBJUBW2n+FJfG8m5euC50b7KAw8D0AhyGAaDN7DTfE+Lxczv+85LShLH2+uxGz4yBWyBivKp4
F2ZYIVrzOqsa7ZOeFUmcA7OBqLQ9Xqn1s56OKS6O8khj7hNgFGSZb48OD4H56iZAnAa9PLlwLXQr8
5tXmgGeycBAUgNcJf8PzhjfGXN/kEDwS20OXHJeKkEZQYon5SVU6tCU+CJtJ7VMVGcQCyGgGbrg+7
EWXb5yf3jpvPdITGbULA==;
Received: from localhost ([::1] helo=bombadil.infradead.org)
by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux))
id 1wtczj-0000000DCxL-0Ptp;
Tue, 11 Aug 2026 03:17:39 +0000
Received: from va-2-18.ptr.blmpb.com ([209.127.231.18])
by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux))
id 1wtczg-0000000DCwo-2XDp
for opensbi@lists.infradead.org;
Tue, 11 Aug 2026 03:17:37 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
s=feishu2303021642; d=spacemit.com; t=1786418250; h=from:subject:
mime-version:from:date:message-id:subject:to:cc:reply-to:content-type:
mime-version:in-reply-to:message-id;
bh=O7xrCyskDlrouNekdnugQDP2SKbxD6x9rUMUPSlLtpY=;
b=AEA0z/y6ycczoBvkX6oLzfyO5oNRAmV8M/0LpLZC4dD/eXap+E1NIUzuHokMr//CrIINQ9
BSYTRVwxxYpZIoQVinAd+ljan1xq7FixhznKbvUtNx+VXeMQgjTHezDLQsJDHaGn+ePrZZ
LNTeRaKWken4RH2xFjylbPADzU45ta0UUkbTR1O5t8zRLuDvfly1Ym9Uj0F8GYH+Y5qMsO
e+oiZRO/genBbzfZpbkXo/oL0t7PiLcTxP9HHD447PxJSajo86QvmpTnTQAnbeRPz4VcLC
Z4NYc++7TYtXTH0dSXc0Cm/PeBNgVf4HWLh8uzjyjCN6d1nwV6SPFYgfQelxBg==
From: "Huamao Wu" <huamao.wu@spacemit.com>
X-Lms-Return-Path:
<lba+16a7a9448+0785d3+lists.infradead.org+huamao.wu@spacemit.com>
Date: Tue, 11 Aug 2026 11:17:27 +0800
To: "opensbi@lists.infradead.org" <opensbi@lists.infradead.org>
Cc: "anup@brainfault.org" <anup@brainfault.org>,
"atishp@atishpatra.org" <atishp@atishpatra.org>
Subject: [PATCH] lib: Fix MSTATUS_FS bit usage in sbi_fp_save()
Mime-Version: 1.0
Message-Id:
<598191cd2102633b80b8890af6c8b3292fb76242.15545c56.8705.442f.b574.8164d38a1edb@feishu.cn>
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3
X-CRM114-CacheID: sfid-20260810_201736_718923_9B95FA23
X-CRM114-Status: GOOD ( 11.07 )
X-Spam-Score: -2.1 (--)
X-Spam-Report: Spam detection software,
running on the system "bombadil.infradead.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: The sbi_fp_save() function incorrectly uses MSTATUS_VS
(0x600,
Vector extension state) instead of MSTATUS_FS (0x6000,
Floating-Point extension
state) when enabling floating-point instructions before s [...]
Content analysis details: (-2.1 points, 5.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
author's
domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK
signature
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
0.0 DMARC_MISSING Missing DMARC policy
X-BeenThere: opensbi@lists.infradead.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: <opensbi.lists.infradead.org>
List-Unsubscribe: <http://lists.infradead.org/mailman/options/opensbi>,
<mailto:opensbi-request@lists.infradead.org?subject=unsubscribe>
List-Archive: <http://lists.infradead.org/pipermail/opensbi/>
List-Post: <mailto:opensbi@lists.infradead.org>
List-Help: <mailto:opensbi-request@lists.infradead.org?subject=help>
List-Subscribe: <http://lists.infradead.org/mailman/listinfo/opensbi>,
<mailto:opensbi-request@lists.infradead.org?subject=subscribe>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
Sender: "opensbi" <opensbi-bounces@lists.infradead.org>
Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org
|
| Series |
lib: Fix MSTATUS_FS bit usage in sbi_fp_save()
|
expand
|
diff --git a/lib/sbi/sbi_fp.c b/lib/sbi/sbi_fp.c index c8941252..38fb7a01 100644 --- a/lib/sbi/sbi_fp.c +++ b/lib/sbi/sbi_fp.c @@ -20,7 +20,7 @@ void sbi_fp_save(struct sbi_fp_context *dst) if (!dst) return; - mstatus_orig = csr_read_set(CSR_MSTATUS, MSTATUS_VS); + mstatus_orig = csr_read_set(CSR_MSTATUS, MSTATUS_FS); asm volatile( #if defined(__riscv_d)
The sbi_fp_save() function incorrectly uses MSTATUS_VS (0x600, Vector extension state) instead of MSTATUS_FS (0x6000, Floating-Point extension state) when enabling floating-point instructions before saving FP registers. This causes an illegal instruction exception when executing the first fsd/fsw instruction, because the FP unit remains disabled (MSTATUS.FS=0) while the code attempts to access FP registers. The bug was introduced in commit 718e1d194f5a ("lib: Add FP context save/restore support", 2026-05-18) and affects OpenSBI v1.9 and later versions. Symptom observed on a development platform with dual 40-hart RVA23 CPUs and OP-TEE: - Domain context switch triggers sbi_fp_save() - First fsd instruction at PC 0x23ce4 raises illegal instruction trap - System fails to enter OP-TEE trusted domain The sbi_fp_restore() function in the same file correctly uses MSTATUS_FS (line 112), confirming this is a copy-paste error. Fix: Change MSTATUS_VS to MSTATUS_FS in sbi_fp_save(). Signed-off-by: Huamao Wu <huamao.wu@spacemit.com> --- lib/sbi/sbi_fp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not an intended recipient of this message, please delete it and any attachment from your system and notify the sender immediately by reply e-mail. Unintended recipients should not use, copy, disclose or take any action based on this message or any information contained in this message. Emails cannot be guaranteed to be secure or error free as they can be intercepted, amended, lost or destroyed, and you should take full responsibility for security checking. 本邮件及其任何附件具有保密性质,并可能受其他保护或不允许被披露给第三方。如阁下误收到本邮件,敬请立即以回复电子邮件的方式通知发件人,并将本邮件及其任何附件从阁下系统中予以删除。如阁下并非本邮件写明之收件人,敬请切勿使用、复制、披露本邮件或其任何内容,亦请切勿依本邮件或其任何内容而采取任何行动。电子邮件无法保证是一种安全和不会出现任何差错的通信方式,可能会被拦截、修改、丢失或损坏,收件人需自行负责做好安全检查。