Skip to content

Commit

Permalink
riscv: Support XUANTIE extended CSR save/restore during task switching
Browse files Browse the repository at this point in the history
This patch focuses on two XUANTIE extended CSRs:
- FXCR[31]: Process 16-bit floating point numbers according to the BFloat
16 format.
- UTNMODE: FP8 output can be ovf or sat mode. Introduced by XUANTIE C908X.

When using, first enable CONFIG_XUANTIE_CSR_EXT, then set the 'riscv,isa'
fields of dts to dynamically control whether to save/restore the
corresponding CSR. For example, for FXCR, you need to add 'xtheadfxcr',
and for UTNMODE, you need to add 'xtheadutnmode'.

Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
  • Loading branch information
cp0613 committed Dec 24, 2024
1 parent 687aa40 commit b5827bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions arch/riscv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,9 @@ config XUANTIE_CSR_EXT
default y
depends on FPU
help
XUANTIE U-mode Extended Control and Status Register.

If unsure, say N.
This config enable XUANTIE U-mode Extended Control and Status Register.
These CSRs may be set to different values ​​by the user in different processes, and

Check failure on line 730 in arch/riscv/Kconfig

View workflow job for this annotation

GitHub Actions / checkpatch

ERROR: trailing whitespace
can be saved and restored when switching tasks in combination with dts.

menu "Kernel features"

Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/include/asm/xuantie_csr_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ static __always_inline bool has_xuantie_csr_ext(void) { return false; }
#define __switch_to_xuantie_csr_ext(__prev, __next) do {} while (0)

#endif /* CONFIG_XUANTIE_CSR_EXT */
#endif /* _ASM_XUANTIE_CSR_EXT_H */
#endif /* _ASM_XUANTIE_CSR_EXT_H */

Check failure on line 38 in arch/riscv/include/asm/xuantie_csr_ext.h

View workflow job for this annotation

GitHub Actions / checkpatch

WARNING: adding a line without newline at end of file

0 comments on commit b5827bc

Please sign in to comment.