diff options
author | Claudio Fontana <cfontana@suse.de> | 2020-08-19 13:17:19 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-10-05 16:41:22 +0200 |
commit | 740b175973427bcfa32ad894bb1f83b96d184c28 (patch) | |
tree | 3613e83be5fd8620b369479b98e6ede5d5746a9a /target/riscv | |
parent | 0ac0b47c44b4be6cbce26777a1a5968cc8f025a5 (diff) | |
download | qemu-740b175973427bcfa32ad894bb1f83b96d184c28.zip |
cpu-timers, icount: new modules
refactoring of cpus.c continues with cpu timer state extraction.
cpu-timers: responsible for the softmmu cpu timers state,
including cpu clocks and ticks.
icount: counts the TCG instructions executed. As such it is specific to
the TCG accelerator. Therefore, it is built only under CONFIG_TCG.
One complication is due to qtest, which uses an icount field to warp time
as part of qtest (qtest_clock_warp).
In order to solve this problem, provide a separate counter for qtest.
This requires fixing assumptions scattered in the code that
qtest_enabled() implies icount_enabled(), checking each specific case.
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[remove redundant initialization with qemu_spice_init]
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
[fix lingering calls to icount_get]
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/riscv')
-rw-r--r-- | target/riscv/csr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/target/riscv/csr.c b/target/riscv/csr.c index 26ae347b4a..e51ed7b9ca 100644 --- a/target/riscv/csr.c +++ b/target/riscv/csr.c @@ -299,7 +299,7 @@ static int write_vstart(CPURISCVState *env, int csrno, target_ulong val) static int read_instret(CPURISCVState *env, int csrno, target_ulong *val) { #if !defined(CONFIG_USER_ONLY) - if (use_icount) { + if (icount_enabled()) { *val = cpu_get_icount(); } else { *val = cpu_get_host_ticks(); @@ -314,7 +314,7 @@ static int read_instret(CPURISCVState *env, int csrno, target_ulong *val) static int read_instreth(CPURISCVState *env, int csrno, target_ulong *val) { #if !defined(CONFIG_USER_ONLY) - if (use_icount) { + if (icount_enabled()) { *val = cpu_get_icount() >> 32; } else { *val = cpu_get_host_ticks() >> 32; |