arch/risc-v64: Add lazy FPU stacking and QEMU functional tests for GNU port#549
Open
Winstonllllai wants to merge 4 commits into
Open
arch/risc-v64: Add lazy FPU stacking and QEMU functional tests for GNU port#549Winstonllllai wants to merge 4 commits into
Winstonllllai wants to merge 4 commits into
Conversation
Merge changes for the v6.5.1.202602a release
Save mstatus/sstatus to stack slot 29 and skip floating-point register save/restore when FS is Off (bits 14:13). This avoids unnecessary FP context work for threads that do not use the FPU. - context_save: check FS in nested and first-level interrupt paths - context_restore: gate FP restore on nested, no-preempt, and preempt paths - use sstatus when TX_RISCV_SMODE is defined, otherwise mstatus
Wire the QEMU virt demo into the CMake build system and add a Python/GDB functional test runner, mirroring the risc-v32/gnu port. - Add qemu_virt/CMakeLists.txt to build kernel.elf and register the check-functional-riscv64 target (requires Python3; skipped if absent) - Link kernel.elf with --whole-archive so all ThreadX symbols resolve - Pin _start at 0x80000000 via .text.boot in entry.s and KEEP(*(.text.boot)) in link.lds - Extend demo_threadx.c with fpu_test_val and shorten thread_0 sleep for GDB-driven FPU, timer, and preemption checks - Add test/azrtos_test_tx_gnu_riscv64_qemu.py; verified passing on QEMU virt (FPU, timer interrupt, preemption)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds functional enhancements for the ThreadX RISC-V 64-bit (RV64) GNU port, mirroring the improvements delivered for RV32 in #513.
Lazy FPU Stacking:
_tx_thread_context_saveand_tx_thread_context_restoreto savemstatus/sstatusand skip FP register save/restore when the FS field (bits 14:13) is Off.TX_RISCV_SMODE(readssstatusvsmstatusas appropriate).Automated Testing Framework:
azrtos_test_tx_gnu_riscv64_qemu.py).qemu_virt/CMakeLists.txtand registered thecheck-functional-riscv64target.demo_threadx.cwithfpu_test_valand adjusted thread timing for GDB-driven verification.QEMU Boot & Link Fixes:
_startin a.text.bootsection and addedKEEP(*(.text.boot))tolink.ldsso the entry point is pinned at0x80000000(QEMU virt reset PC).kernel.elfwith--whole-archiveto ensure all ThreadX symbols resolve on RV64.How to Run Tests
cmake -B build_qemu -DCMAKE_TOOLCHAIN_FILE=cmake/riscv64_gnu.cmake cd build_qemu make check-functional-riscv64Tested on QEMU virt machine (rv64gc).
Please let me know if there is anything I should improve or if I missed anything.