aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorClaudio Fontana <cfontana@suse.de>2020-08-19 13:17:19 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-10-05 16:41:22 +0200
commit740b175973427bcfa32ad894bb1f83b96d184c28 (patch)
tree3613e83be5fd8620b369479b98e6ede5d5746a9a /hw
parent0ac0b47c44b4be6cbce26777a1a5968cc8f025a5 (diff)
downloadqemu-740b175973427bcfa32ad894bb1f83b96d184c28.zip
qemu-740b175973427bcfa32ad894bb1f83b96d184c28.tar.gz
qemu-740b175973427bcfa32ad894bb1f83b96d184c28.tar.bz2
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 'hw')
-rw-r--r--hw/core/ptimer.c8
-rw-r--r--hw/i386/x86.c1
2 files changed, 6 insertions, 3 deletions
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index b5a54e2..c6d2beb 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -7,11 +7,11 @@
*/
#include "qemu/osdep.h"
-#include "qemu/timer.h"
#include "hw/ptimer.h"
#include "migration/vmstate.h"
#include "qemu/host-utils.h"
#include "sysemu/replay.h"
+#include "sysemu/cpu-timers.h"
#include "sysemu/qtest.h"
#include "block/aio.h"
#include "sysemu/cpus.h"
@@ -134,7 +134,8 @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)
* on the current generation of host machines.
*/
- if (s->enabled == 1 && (delta * period < 10000) && !use_icount) {
+ if (s->enabled == 1 && (delta * period < 10000) &&
+ !icount_enabled() && !qtest_enabled()) {
period = 10000 / delta;
period_frac = 0;
}
@@ -217,7 +218,8 @@ uint64_t ptimer_get_count(ptimer_state *s)
uint32_t period_frac = s->period_frac;
uint64_t period = s->period;
- if (!oneshot && (s->delta * period < 10000) && !use_icount) {
+ if (!oneshot && (s->delta * period < 10000) &&
+ !icount_enabled() && !qtest_enabled()) {
period = 10000 / s->delta;
period_frac = 0;
}
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 403c2b1..953083e 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -34,6 +34,7 @@
#include "sysemu/numa.h"
#include "sysemu/replay.h"
#include "sysemu/sysemu.h"
+#include "sysemu/cpu-timers.h"
#include "trace.h"
#include "hw/i386/x86.h"