target/riscv: Implement PMU CSR predicate function for S-mode
authorAtish Patra <atish.patra@wdc.com>
Mon, 20 Jun 2022 23:15:52 +0000 (16:15 -0700)
committerAlistair Francis <alistair@alistair23.me>
Sun, 3 Jul 2022 00:03:20 +0000 (10:03 +1000)
commita5a92fd6ef038170231933c60cc2780f52b3a2e1
tree9bc5c4429818ee21e9f8cbe4954f6d5b1a0b04e0
parent562009e47c622298f82ee7557be9e15d5e50cee5
target/riscv: Implement PMU CSR predicate function for S-mode

Currently, the predicate function for PMU related CSRs only works if
virtualization is enabled. It also does not check mcounteren bits before
before cycle/minstret/hpmcounterx access.

Support supervisor mode access in the predicate function as well.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Message-Id: <20220620231603.2547260-3-atishp@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/csr.c