diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2021-03-19 13:04:50 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-03-22 06:48:56 +0300 |
commit | ddad02d62550ca8884a2bd21345dad8c6c216777 (patch) | |
tree | fe035e650ab80c17f97c4b7154e4a85b77ad58e9 /include/sbi | |
parent | 0f20e8adcf42d31bc478d6700b625d00a68cb30e (diff) | |
download | opensbi-ddad02d62550ca8884a2bd21345dad8c6c216777.tar.xz |
lib: sbi: illegal CSR 0x306 access in hpm_allowed()
The trap handler sbi_emulate_csr_read() invokes hpm_allowed() which reads
CSR 0x306 (mcounteren). The K210 does not support CSR 0x306. While trying
to handle a trap occurring in S-mode code this creates an additional trap
in M-mode. This results in failure to redirect to S-mode and the system
hanging in sbi_hart_hang().
In hart_detect_features() we have already determined if CSR 0x306 is
available and stored that information in the scratch area. We can use this
information to decide if CSR 0x306 shall be accessed in hpm_allowed() and
thus avoid the M-mode trap.
Likewise if CSR scounteren is not available we have to avoid reading CSR
0x106.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'include/sbi')
0 files changed, 0 insertions, 0 deletions