-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
riscv: Use macros to create non-PMP CSRs #2470
Conversation
The current giant switch table for RISC-V CSRs is a pain to edit and extend. Instead of relying on it, let's instead use macros with const values to access CSRs/ Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Awhile back I suggested using const generics to pass the addresses of the non-PMP CSRs, as a substitute for the messy code in #1926 . A link to a commit that achieved this is here: hudson-ayers@ab4965c , though it is of course outdated. Now that |
Which can be worked around by not using the default, The problem is that doesn't help with the array problem |
It seems like this PR doesn't help with the array problem either though? Your other recent PR does, but the costs of dynamic dispatch are probably too high anyway |
Yep, it doesn't either. I was originally hoping to get this working the the array (see #2471) but the overhead is too high. I just got the const generic version working (good idea :) ) so I'm going to close this and use that instead. |
2472: riscv: Convert CSRs to use const generics r=bradjc a=alistair23 ### Pull Request Overview The current giant switch table for RISC-V CSRs is a pain to edit and extend. With more RISC-V extensions on the way and with some RISC-V implementations using CSRs to modify the system the list of CSRs is only growing. In an effort to try and cleanup and improve the RISC-V CSRs (which are also some of the largest functions in the Tock kernel) let's use const generics to create the CSR access functions. This means we can drop the large switch case, but we at the same time have to remove the PMP arrays. To save some sanity let's add PMP access functions that can replicate some of the array work. This has no impact on the size of the OpenTitan binary. This replaces #2470 and #2471 Although I think #2471 is cleaner in terms of code, the overhead is too high so this ends up being the best compromise. ### Testing Strategy CI ### TODO or Help Wanted ### Documentation Updated - [X] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [X] Ran `make prepush`. Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
2472: riscv: Convert CSRs to use const generics r=bradjc a=alistair23 ### Pull Request Overview The current giant switch table for RISC-V CSRs is a pain to edit and extend. With more RISC-V extensions on the way and with some RISC-V implementations using CSRs to modify the system the list of CSRs is only growing. In an effort to try and cleanup and improve the RISC-V CSRs (which are also some of the largest functions in the Tock kernel) let's use const generics to create the CSR access functions. This means we can drop the large switch case, but we at the same time have to remove the PMP arrays. To save some sanity let's add PMP access functions that can replicate some of the array work. This has no impact on the size of the OpenTitan binary. This replaces tock#2470 and tock#2471 Although I think tock#2471 is cleaner in terms of code, the overhead is too high so this ends up being the best compromise. ### Testing Strategy CI ### TODO or Help Wanted ### Documentation Updated - [X] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [X] Ran `make prepush`. Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
Pull Request Overview
The current giant switch table for RISC-V CSRs is a pain to edit and extend.
With more RISC-V extensions on the way and with some RISC-V implementations using CSRs to modify the system the list of CSRs is only growing.
In an effort to try and cleanup and improve the RISC-V CSRs (which are also some of the largest functions in the Tock kernel) I have added a macro that generates RISC-V CSR access functions.
Unfortunately I can't figure out a way to do with for the array of PMP CSRs.
Testing Strategy
CI
TODO or Help Wanted
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.