add riscv64 CPU compatibility#257
Merged
Merged
Conversation
tzcnt
reviewed
Jun 20, 2026
82278f0 to
0a9a2bd
Compare
Add a riscv64 branch that uses the Zihintpause pause instruction when the target enables it, otherwise falls back to a nop that is valid for the baseline ISA. Read the Linux device-tree timebase-frequency value from procfs or sysfs as the counter frequency, and use rdtime for timestamps so both helpers use the RISC-V time counter units. Keep the stdio include inside the riscv64 Linux branch so the common compatibility header stays slim on other targets. If Linux device-tree data is unavailable, return a 2GHz heuristic fallback based on the SG2042 clock frequency. Validated by compiling and running a small riscv64 translation unit including tmc/ex_cpu.hpp and tmc/channel.hpp on real riscv64 hardware, where it reported the 50 MHz device-tree timebase. Also validated riscv64 header compilation in the Arch Linux riscv64 chroot and ran the non-Linux fallback preprocessor path, which reported 2GHz.
0a9a2bd to
8618846
Compare
Owner
|
Thanks for your contribution! |
Owner
Contributor
Author
Sure! It seems corrrect. SG2042 has 64 phsyical cores and 1MB * 16Cluster L2 cache, and aligns with the Thanks for your effort in supporting RISC-V! |
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.
Add a riscv64 branch that uses the Zihintpause pause instruction when the target enables it, otherwise falls back to a nop that is valid for the baseline ISA.
Read the Linux device-tree timebase-frequency value from procfs or sysfs as the counter frequency, and use rdtime for timestamps so both helpers use the RISC-V time counter units.