diff options
author | Rob Bradford <rbradford@rivosinc.com> | 2023-10-31 15:37:16 +0000 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2023-11-07 11:06:02 +1000 |
commit | 69b3849bff4bd5ab82241ad09426cd9ff7078449 (patch) | |
tree | 54c284d050500ab73d6ebbef081ced7ed2e55178 /target/riscv/tcg | |
parent | 2571a6427c4ded57e44d4c6cf92376d869a75a5c (diff) | |
download | qemu-69b3849bff4bd5ab82241ad09426cd9ff7078449.zip qemu-69b3849bff4bd5ab82241ad09426cd9ff7078449.tar.gz qemu-69b3849bff4bd5ab82241ad09426cd9ff7078449.tar.bz2 |
target/riscv: Add "pmu-mask" property to replace "pmu-num"
Using a mask instead of the number of PMU devices supports the accurate
emulation of platforms that have a discontinuous set of PMU counters.
The "pmu-num" property now generates a warning when used by the user on
the command line.
Rather than storing the value for "pmu-num" convert it directly to the
mask if it is specified (overwriting the default "pmu-mask" value)
likewise the value is calculated from the mask if the property value is
obtained.
In the unusual situation that both "pmu-mask" and "pmu-num" are provided
then then the order on the command line determines which takes
precedence (later overwriting earlier.)
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20231031154000.18134-5-rbradford@rivosinc.com>
[Changes by AF
- Fixup ext_zihpm logic after rebase
]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/tcg')
-rw-r--r-- | target/riscv/tcg/tcg-cpu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 144bdac..08adad3 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -600,7 +600,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp) } if (!cpu->cfg.ext_zihpm) { - cpu->cfg.pmu_num = 0; + cpu->cfg.pmu_mask = 0; cpu->pmu_avail_ctrs = 0; } @@ -688,7 +688,7 @@ static bool tcg_cpu_realize(CPUState *cs, Error **errp) riscv_timer_init(cpu); } - if (cpu->cfg.pmu_num) { + if (cpu->cfg.pmu_mask) { riscv_pmu_init(cpu, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); |