diff options
author | Atish Patra <atishp@rivosinc.com> | 2024-07-11 15:31:10 -0700 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2024-07-18 12:08:44 +1000 |
commit | b2d7a7c7e4e30fb5341d38deac968de675f9419c (patch) | |
tree | cb43938ffe2840b746896b1c4f24e62d6de675ad /target/riscv/pmu.h | |
parent | 3b31b7baff02b357a6c921b26ae953e04d0cfdbb (diff) | |
download | qemu-b2d7a7c7e4e30fb5341d38deac968de675f9419c.zip qemu-b2d7a7c7e4e30fb5341d38deac968de675f9419c.tar.gz qemu-b2d7a7c7e4e30fb5341d38deac968de675f9419c.tar.bz2 |
target/riscv: Implement privilege mode filtering for cycle/instret
Privilege mode filtering can also be emulated for cycle/instret by
tracking host_ticks/icount during each privilege mode switch. This
patch implements that for both cycle/instret and mhpmcounters. The
first one requires Smcntrpmf while the other one requires Sscofpmf
to be enabled.
The cycle/instret are still computed using host ticks when icount
is not enabled. Otherwise, they are computed using raw icount which
is more accurate in icount mode.
Co-Developed-by: Rajnesh Kanwal <rkanwal@rivosinc.com>
Signed-off-by: Rajnesh Kanwal <rkanwal@rivosinc.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Message-ID: <20240711-smcntrpmf_v7-v8-7-b7c38ae7b263@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/pmu.h')
-rw-r--r-- | target/riscv/pmu.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/target/riscv/pmu.h b/target/riscv/pmu.h index 7c0ad66..ca40cfe 100644 --- a/target/riscv/pmu.h +++ b/target/riscv/pmu.h @@ -34,5 +34,7 @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx); void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name); int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value, uint32_t ctr_idx); +void riscv_pmu_update_fixed_ctrs(CPURISCVState *env, target_ulong newpriv, + bool new_virt); #endif /* RISCV_PMU_H */ |