mirror of
https://github.com/riscv-software-src/opensbi
synced 2025-10-17 06:08:16 +01:00
lib: sbi: Fix initial value mask while updating the counters
The first 32 bits of the initial value for the counter should be preserved while updating the mhpmcounter for 32bit. Fixes: 13d40f21d588e ("lib: sbi: Add PMU support") Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
parent
15906a3984
commit
b8845e4204
@ -270,7 +270,7 @@ static void pmu_ctr_write_hw(uint32_t cidx, uint64_t ival)
|
||||
{
|
||||
#if __riscv_xlen == 32
|
||||
csr_write_num(CSR_MCYCLE + cidx, 0);
|
||||
csr_write_num(CSR_MCYCLE + cidx, ival & 0xFFFF);
|
||||
csr_write_num(CSR_MCYCLE + cidx, ival & 0xFFFFFFFF);
|
||||
csr_write_num(CSR_MCYCLEH + cidx, ival >> BITS_PER_LONG);
|
||||
#else
|
||||
csr_write_num(CSR_MCYCLE + cidx, ival);
|
||||
|
Loading…
x
Reference in New Issue
Block a user