From: "Radim Krčmář" <radim.krcmar@oss.qualcomm.com>
To: <dave.patel@riscstar.com>, "Samuel Holland" <samuel.holland@sifive.com>
Cc: "Scott Bambrough" <scott@riscstar.com>,
"Robin Randhawa" <robin.randhawa@sifive.com>,
"Anup Patel" <anup.patel@qti.qualcomm.com>,
"Ray Mao" <raymond.mao@riscstar.com>,
"Anup Patel" <anuppate@qti.qualcomm.com>,
"Dhaval" <dhaval@rivosinc.com>,
"Peter Lin" <peter.lin@sifive.com>, <opensbi@lists.infradead.org>,
"opensbi" <opensbi-bounces@lists.infradead.org>
Subject: Re: [PATCH v3 2/3] lib: sbi: Add floating-point context save/restore support.
Date: Thu, 02 Apr 2026 15:40:01 +0200 [thread overview]
Message-ID: <DHIPMCI378P5.2V9E4QV6R9BTW@oss.qualcomm.com> (raw)
In-Reply-To: <20260331055858.305207-3-dave.patel@riscstar.com>
2026-03-31T06:58:56+01:00, <dave.patel@riscstar.com>:
> From: Dave Patel <dave.patel@riscstar.com>
>
> Add support for saving and restoring RISC-V floating-point (F/D) extension
> state in OpenSBI. This introduces a floating-point context structure and
> helper routines to perform full context save and restore.
>
> The floating-point context includes storage for all 32 FPi registers (f0–f31)
> along with the fcsr control and status register. The register state is saved
> and restored using double-precision load/store instructions (fsd/fld), and
> single-precision load/store instructions (fsw/flw) on an RV64 system with
> F and D-extension support.
>
> The implementation follows an eager context switching model where the entire
> FP state is saved and restored on every context switch. This avoids the need
> for trap-based lazy management and keeps the design simple and deterministic.
>
> Signed-off-by: Dave Patel <dave.patel@riscstar.com>"
> ---
> diff --git a/lib/sbi/sbi_vector.c b/lib/sbi/sbi_vector.c
> @@ -50,8 +50,8 @@ void sbi_vector_save(struct sbi_vector_context *dst)
> if (!dst)
> return;
>
> -#define READ_CSR(dst, csr) ( \
> - do { \
> +#define READ_CSR(dst, csr) \
> + { \
Please, change the first patch instead of fixing the bug here.
(Btw. "({ ... })" is a superior macro wrapper.)
Thanks.
[...]
> - } while (0))
> + }
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-04-02 13:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 5:58 [PATCH v3 0/3] Add eager FP and RISC-V vector context switching support dave.patel
2026-03-31 5:58 ` [PATCH v3 1/3] lib: sbi: Add RISC-V vector context save/restore support dave.patel
2026-04-02 13:35 ` Radim Krčmář
2026-03-31 5:58 ` [PATCH v3 2/3] lib: sbi: Add floating-point " dave.patel
2026-04-02 13:40 ` Radim Krčmář [this message]
2026-03-31 5:58 ` [PATCH v3 3/3] lib: sbi: domain FP/Vector context support for context switch dave.patel
2026-04-02 13:54 ` Radim Krčmář
-- strict thread matches above, loose matches on Subject: below --
2026-03-27 17:15 [PATCH v3 0/3] Add eager FP and RISC-V vector context switching support dave.patel
2026-03-27 17:16 ` [PATCH v3 2/3] lib: sbi: Add floating-point context save/restore support dave.patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DHIPMCI378P5.2V9E4QV6R9BTW@oss.qualcomm.com \
--to=radim.krcmar@oss.qualcomm.com \
--cc=anup.patel@qti.qualcomm.com \
--cc=anuppate@qti.qualcomm.com \
--cc=dave.patel@riscstar.com \
--cc=dhaval@rivosinc.com \
--cc=opensbi-bounces@lists.infradead.org \
--cc=opensbi@lists.infradead.org \
--cc=peter.lin@sifive.com \
--cc=raymond.mao@riscstar.com \
--cc=robin.randhawa@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=scott@riscstar.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox