Add eager FP and RISC-V vector context switching support
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v7 Latest3 patches 5 repliesIn review
- v63 patches 3 repliesSuperseded
- v5 posting 3/33 patches 0 repliesSuperseded
Earlier versions · 9
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v5 posting 2/3 | 4 patches | 8 replies | Superseded | |
| v5 posting 1/3 | 0 of 3 patches | 1 reply | Superseded | |
| v4 posting 3/3 | 3 patches | 8 replies | Superseded | |
| v4 posting 2/3 | 3 patches | 3 replies | Superseded | |
| v4 posting 1/3 | 3 patches | 4 replies | Superseded | |
| v3 posting 2/2 | 3 patches | 3 replies | Superseded | |
| v3 posting 1/2 | 3 patches | 3 replies | Superseded | |
| v2 | 3 patches | 3 replies | Superseded | |
| v1 | 4 patches | 3 replies | Superseded |
Patches in v7 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | lib: sbi: Add RISC-V vector context save/restore supportinclude/ lib/ lib/ | +147 | 1 reply | |
| 2/3 | lib: sbi: Add floating-point context save/restore support.include/ lib/ lib/ | +234 | 1 reply | |
| 3/3 | lib: sbi: domain FP/Vector context support for context switchinclude/ lib/ lib/ | +45 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v7 yet.
Cover letter [PATCH v7 0/3] Add eager FP and RISC-V vector context switching support
From: Dave Patel <[email protected]>
This patch series adds proper support for per-domain floating-point (FP) and vector (V) contexts in the domain context switch logic. Each domain now maintains its own FP and vector state, which is saved and restored during domain switches.
Conditionalize FP and Vector save/restore based on extensions, unconditional save and restore of floating-point (FP) and Vector registers fails on generic platform firmware. This firmware must run on multiple platforms that may lack these extensions.
Address this by conditionally executing FP save/restore only if the underlying hart supports the F or D extensions. Similarly, perform Vector save/restore only if the hart supports the Vector extension.
Changes include:
- Add Vector save and restore functionality
- Add Floating Point save and restore functioanlity
- Added fp_ctx and vec_ctx members to struct hart_context.
- Introduced dynamic vector struct allocation for vlenb in 'struct hart_context' to allocate and free per-domain FP and vector context.
- Modified sbi_domain_register() to initialize FP/Vector context per domain.
- Updated switch_to_next_domain_context() to save/restore FP and vector contexts safely:
- Ensures FS/VS fields in mstatus are enabled (set to Initial) only if Off.
- Added runtime checks for FP and vector extensions where needed.
- Added SBI_HART_EXT_F, SBI_HART_EXT_D, SBI_HART_EXT_V to enum sbi_hart_extensions and the sbi_hart_ext[] array. Use sbi_hart_has_extension() to check for these capabilities before performing the context switches
This improves support for multi-domain systems with FP and Vector extensions, and prevents corruption of FP/Vector state during domain switches.
Dave Patel (3):
lib: sbi: Add RISC-V vector context save/restore support
lib: sbi: Add floating-point context save/restore support.
lib: sbi: domain FP/Vector context support for context switch
include/sbi/sbi_fp.h | 26 +++++ include/sbi/sbi_hart.h | 6 + include/sbi/sbi_vector.h | 28 +++++ lib/sbi/objects.mk | 2 + lib/sbi/sbi_domain_context.c | 36 ++++++ lib/sbi/sbi_fp.c | 207 +++++++++++++++++++++++++++++++++++ lib/sbi/sbi_hart.c | 3 + lib/sbi/sbi_vector.c | 118 ++++++++++++++++++++ 8 files changed, 426 insertions(+) create mode 100644 include/sbi/sbi_fp.h create mode 100644 include/sbi/sbi_vector.h create mode 100644 lib/sbi/sbi_fp.c create mode 100644 lib/sbi/sbi_vector.c
--
2.43.0
Signature · 3 lines
opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi