mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
aio / timers: Switch entire codebase to the new timer API
This is an autogenerated patch using scripts/switch-timer-api. Switch the entire code base to using the new timer API. Note this patch may introduce some line length issues. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
committed by
Stefan Hajnoczi
parent
fe10ab540b
commit
bc72ad6754
+6
-6
@@ -392,7 +392,7 @@ static void migration_bitmap_sync(void)
|
||||
}
|
||||
|
||||
if (!start_time) {
|
||||
start_time = qemu_get_clock_ms(rt_clock);
|
||||
start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
||||
}
|
||||
|
||||
trace_migration_bitmap_sync_start();
|
||||
@@ -410,7 +410,7 @@ static void migration_bitmap_sync(void)
|
||||
trace_migration_bitmap_sync_end(migration_dirty_pages
|
||||
- num_dirty_pages_init);
|
||||
num_dirty_pages_period += migration_dirty_pages - num_dirty_pages_init;
|
||||
end_time = qemu_get_clock_ms(rt_clock);
|
||||
end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
||||
|
||||
/* more than 1 second = 1000 millisecons */
|
||||
if (end_time > start_time + 1000) {
|
||||
@@ -672,7 +672,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
|
||||
|
||||
ram_control_before_iterate(f, RAM_CONTROL_ROUND);
|
||||
|
||||
t0 = qemu_get_clock_ns(rt_clock);
|
||||
t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||
i = 0;
|
||||
while ((ret = qemu_file_rate_limit(f)) == 0) {
|
||||
int bytes_sent;
|
||||
@@ -691,7 +691,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
|
||||
iterations
|
||||
*/
|
||||
if ((i & 63) == 0) {
|
||||
uint64_t t1 = (qemu_get_clock_ns(rt_clock) - t0) / 1000000;
|
||||
uint64_t t1 = (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - t0) / 1000000;
|
||||
if (t1 > MAX_WAIT) {
|
||||
DPRINTF("big wait: %" PRIu64 " milliseconds, %d iterations\n",
|
||||
t1, i);
|
||||
@@ -1217,11 +1217,11 @@ static void check_guest_throttling(void)
|
||||
}
|
||||
|
||||
if (!t0) {
|
||||
t0 = qemu_get_clock_ns(rt_clock);
|
||||
t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||
return;
|
||||
}
|
||||
|
||||
t1 = qemu_get_clock_ns(rt_clock);
|
||||
t1 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||
|
||||
/* If it has been more than 40 ms since the last time the guest
|
||||
* was throttled then do it again.
|
||||
|
||||
+3
-3
@@ -1124,10 +1124,10 @@ static int audio_is_timer_needed (void)
|
||||
static void audio_reset_timer (AudioState *s)
|
||||
{
|
||||
if (audio_is_timer_needed ()) {
|
||||
qemu_mod_timer (s->ts, qemu_get_clock_ns (vm_clock) + 1);
|
||||
timer_mod (s->ts, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1);
|
||||
}
|
||||
else {
|
||||
qemu_del_timer (s->ts);
|
||||
timer_del (s->ts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1834,7 +1834,7 @@ static void audio_init (void)
|
||||
QLIST_INIT (&s->cap_head);
|
||||
atexit (audio_atexit);
|
||||
|
||||
s->ts = qemu_new_timer_ns (vm_clock, audio_timer, s);
|
||||
s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s);
|
||||
if (!s->ts) {
|
||||
hw_error("Could not create audio timer\n");
|
||||
}
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ static int no_run_out (HWVoiceOut *hw, int live)
|
||||
int64_t ticks;
|
||||
int64_t bytes;
|
||||
|
||||
now = qemu_get_clock_ns (vm_clock);
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
ticks = now - no->old_ticks;
|
||||
bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
|
||||
bytes = audio_MIN (bytes, INT_MAX);
|
||||
@@ -102,7 +102,7 @@ static int no_run_in (HWVoiceIn *hw)
|
||||
int samples = 0;
|
||||
|
||||
if (dead) {
|
||||
int64_t now = qemu_get_clock_ns (vm_clock);
|
||||
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
int64_t ticks = now - no->old_ticks;
|
||||
int64_t bytes =
|
||||
muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ static void spice_audio_fini (void *opaque)
|
||||
static void rate_start (SpiceRateCtl *rate)
|
||||
{
|
||||
memset (rate, 0, sizeof (*rate));
|
||||
rate->start_ticks = qemu_get_clock_ns (vm_clock);
|
||||
rate->start_ticks = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
}
|
||||
|
||||
static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate)
|
||||
@@ -91,7 +91,7 @@ static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate)
|
||||
int64_t bytes;
|
||||
int64_t samples;
|
||||
|
||||
now = qemu_get_clock_ns (vm_clock);
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
ticks = now - rate->start_ticks;
|
||||
bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ());
|
||||
samples = (bytes - rate->bytes_sent) >> info->shift;
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ static int wav_run_out (HWVoiceOut *hw, int live)
|
||||
int rpos, decr, samples;
|
||||
uint8_t *dst;
|
||||
struct st_sample *src;
|
||||
int64_t now = qemu_get_clock_ns (vm_clock);
|
||||
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
int64_t ticks = now - wav->old_ticks;
|
||||
int64_t bytes =
|
||||
muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
|
||||
|
||||
+6
-6
@@ -315,7 +315,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
|
||||
if (*cur++ != ESC) { \
|
||||
DPRINTF("Broken packet %#2x, tossing\n", req); \
|
||||
if (timer_pending(baum->cellCount_timer)) { \
|
||||
qemu_del_timer(baum->cellCount_timer); \
|
||||
timer_del(baum->cellCount_timer); \
|
||||
baum_cellCount_timer_cb(baum); \
|
||||
} \
|
||||
return (cur - 2 - buf); \
|
||||
@@ -334,7 +334,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
|
||||
int i;
|
||||
|
||||
/* Allow 100ms to complete the DisplayData packet */
|
||||
qemu_mod_timer(baum->cellCount_timer, qemu_get_clock_ns(vm_clock) +
|
||||
timer_mod(baum->cellCount_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
|
||||
get_ticks_per_sec() / 10);
|
||||
for (i = 0; i < baum->x * baum->y ; i++) {
|
||||
EAT(c);
|
||||
@@ -348,7 +348,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
|
||||
c = '?';
|
||||
text[i] = c;
|
||||
}
|
||||
qemu_del_timer(baum->cellCount_timer);
|
||||
timer_del(baum->cellCount_timer);
|
||||
|
||||
memset(zero, 0, sizeof(zero));
|
||||
|
||||
@@ -553,7 +553,7 @@ static void baum_close(struct CharDriverState *chr)
|
||||
{
|
||||
BaumDriverState *baum = chr->opaque;
|
||||
|
||||
qemu_free_timer(baum->cellCount_timer);
|
||||
timer_free(baum->cellCount_timer);
|
||||
if (baum->brlapi) {
|
||||
brlapi__closeConnection(baum->brlapi);
|
||||
g_free(baum->brlapi);
|
||||
@@ -588,7 +588,7 @@ CharDriverState *chr_baum_init(void)
|
||||
goto fail_handle;
|
||||
}
|
||||
|
||||
baum->cellCount_timer = qemu_new_timer_ns(vm_clock, baum_cellCount_timer_cb, baum);
|
||||
baum->cellCount_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, baum_cellCount_timer_cb, baum);
|
||||
|
||||
if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) {
|
||||
brlapi_perror("baum_init: brlapi_getDisplaySize");
|
||||
@@ -614,7 +614,7 @@ CharDriverState *chr_baum_init(void)
|
||||
return chr;
|
||||
|
||||
fail:
|
||||
qemu_free_timer(baum->cellCount_timer);
|
||||
timer_free(baum->cellCount_timer);
|
||||
brlapi__closeConnection(handle);
|
||||
fail_handle:
|
||||
g_free(handle);
|
||||
|
||||
@@ -130,8 +130,8 @@ void bdrv_io_limits_disable(BlockDriverState *bs)
|
||||
do {} while (qemu_co_enter_next(&bs->throttled_reqs));
|
||||
|
||||
if (bs->block_timer) {
|
||||
qemu_del_timer(bs->block_timer);
|
||||
qemu_free_timer(bs->block_timer);
|
||||
timer_del(bs->block_timer);
|
||||
timer_free(bs->block_timer);
|
||||
bs->block_timer = NULL;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ static void bdrv_block_timer(void *opaque)
|
||||
|
||||
void bdrv_io_limits_enable(BlockDriverState *bs)
|
||||
{
|
||||
bs->block_timer = qemu_new_timer_ns(vm_clock, bdrv_block_timer, bs);
|
||||
bs->block_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, bdrv_block_timer, bs);
|
||||
bs->io_limits_enabled = true;
|
||||
}
|
||||
|
||||
@@ -180,8 +180,8 @@ static void bdrv_io_limits_intercept(BlockDriverState *bs,
|
||||
*/
|
||||
|
||||
while (bdrv_exceed_io_limits(bs, nb_sectors, is_write, &wait_time)) {
|
||||
qemu_mod_timer(bs->block_timer,
|
||||
wait_time + qemu_get_clock_ns(vm_clock));
|
||||
timer_mod(bs->block_timer,
|
||||
wait_time + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
|
||||
qemu_co_queue_wait_insert_head(&bs->throttled_reqs);
|
||||
}
|
||||
|
||||
@@ -3747,7 +3747,7 @@ static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors,
|
||||
double elapsed_time;
|
||||
int bps_ret, iops_ret;
|
||||
|
||||
now = qemu_get_clock_ns(vm_clock);
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
if (now > bs->slice_end) {
|
||||
bs->slice_start = now;
|
||||
bs->slice_end = now + BLOCK_IO_SLICE_TIME;
|
||||
@@ -3767,7 +3767,7 @@ static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors,
|
||||
*wait = max_wait;
|
||||
}
|
||||
|
||||
now = qemu_get_clock_ns(vm_clock);
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
if (bs->slice_end < now + max_wait) {
|
||||
bs->slice_end = now + max_wait;
|
||||
}
|
||||
|
||||
+7
-7
@@ -960,7 +960,7 @@ static void iscsi_nop_timed_event(void *opaque)
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_mod_timer(iscsilun->nop_timer, qemu_get_clock_ms(rt_clock) + NOP_INTERVAL);
|
||||
timer_mod(iscsilun->nop_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
|
||||
iscsi_set_events(iscsilun);
|
||||
}
|
||||
#endif
|
||||
@@ -1173,8 +1173,8 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags)
|
||||
|
||||
#if defined(LIBISCSI_FEATURE_NOP_COUNTER)
|
||||
/* Set up a timer for sending out iSCSI NOPs */
|
||||
iscsilun->nop_timer = qemu_new_timer_ms(rt_clock, iscsi_nop_timed_event, iscsilun);
|
||||
qemu_mod_timer(iscsilun->nop_timer, qemu_get_clock_ms(rt_clock) + NOP_INTERVAL);
|
||||
iscsilun->nop_timer = timer_new_ms(QEMU_CLOCK_REALTIME, iscsi_nop_timed_event, iscsilun);
|
||||
timer_mod(iscsilun->nop_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
|
||||
#endif
|
||||
|
||||
out:
|
||||
@@ -1204,8 +1204,8 @@ static void iscsi_close(BlockDriverState *bs)
|
||||
struct iscsi_context *iscsi = iscsilun->iscsi;
|
||||
|
||||
if (iscsilun->nop_timer) {
|
||||
qemu_del_timer(iscsilun->nop_timer);
|
||||
qemu_free_timer(iscsilun->nop_timer);
|
||||
timer_del(iscsilun->nop_timer);
|
||||
timer_free(iscsilun->nop_timer);
|
||||
}
|
||||
qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), NULL, NULL, NULL);
|
||||
iscsi_destroy_context(iscsi);
|
||||
@@ -1267,8 +1267,8 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options)
|
||||
goto out;
|
||||
}
|
||||
if (iscsilun->nop_timer) {
|
||||
qemu_del_timer(iscsilun->nop_timer);
|
||||
qemu_free_timer(iscsilun->nop_timer);
|
||||
timer_del(iscsilun->nop_timer);
|
||||
timer_free(iscsilun->nop_timer);
|
||||
}
|
||||
if (iscsilun->type != TYPE_DISK) {
|
||||
ret = -ENODEV;
|
||||
|
||||
+3
-3
@@ -356,7 +356,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
||||
}
|
||||
|
||||
bdrv_dirty_iter_init(bs, &s->hbi);
|
||||
last_pause_ns = qemu_get_clock_ns(rt_clock);
|
||||
last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||
for (;;) {
|
||||
uint64_t delay_ns;
|
||||
int64_t cnt;
|
||||
@@ -374,7 +374,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
||||
* We do so every SLICE_TIME nanoseconds, or when there is an error,
|
||||
* or when the source is clean, whichever comes first.
|
||||
*/
|
||||
if (qemu_get_clock_ns(rt_clock) - last_pause_ns < SLICE_TIME &&
|
||||
if (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - last_pause_ns < SLICE_TIME &&
|
||||
s->common.iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
|
||||
if (s->in_flight == MAX_IN_FLIGHT || s->buf_free_count == 0 ||
|
||||
(cnt == 0 && s->in_flight > 0)) {
|
||||
@@ -454,7 +454,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
||||
s->common.cancelled = false;
|
||||
break;
|
||||
}
|
||||
last_pause_ns = qemu_get_clock_ns(rt_clock);
|
||||
last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||
}
|
||||
|
||||
immediate_exit:
|
||||
|
||||
+5
-5
@@ -353,10 +353,10 @@ static void qed_start_need_check_timer(BDRVQEDState *s)
|
||||
{
|
||||
trace_qed_start_need_check_timer(s);
|
||||
|
||||
/* Use vm_clock so we don't alter the image file while suspended for
|
||||
/* Use QEMU_CLOCK_VIRTUAL so we don't alter the image file while suspended for
|
||||
* migration.
|
||||
*/
|
||||
qemu_mod_timer(s->need_check_timer, qemu_get_clock_ns(vm_clock) +
|
||||
timer_mod(s->need_check_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
|
||||
get_ticks_per_sec() * QED_NEED_CHECK_TIMEOUT);
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ static void qed_start_need_check_timer(BDRVQEDState *s)
|
||||
static void qed_cancel_need_check_timer(BDRVQEDState *s)
|
||||
{
|
||||
trace_qed_cancel_need_check_timer(s);
|
||||
qemu_del_timer(s->need_check_timer);
|
||||
timer_del(s->need_check_timer);
|
||||
}
|
||||
|
||||
static void bdrv_qed_rebind(BlockDriverState *bs)
|
||||
@@ -494,7 +494,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
s->need_check_timer = qemu_new_timer_ns(vm_clock,
|
||||
s->need_check_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
|
||||
qed_need_check_timer_cb, s);
|
||||
|
||||
out:
|
||||
@@ -518,7 +518,7 @@ static void bdrv_qed_close(BlockDriverState *bs)
|
||||
BDRVQEDState *s = bs->opaque;
|
||||
|
||||
qed_cancel_need_check_timer(s);
|
||||
qemu_free_timer(s->need_check_timer);
|
||||
timer_free(s->need_check_timer);
|
||||
|
||||
/* Ensure writes reach stable storage */
|
||||
bdrv_flush(bs->file);
|
||||
|
||||
+1
-1
@@ -1299,7 +1299,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
|
||||
bdrv_io_limits_disable(bs);
|
||||
} else {
|
||||
if (bs->block_timer) {
|
||||
qemu_mod_timer(bs->block_timer, qemu_get_clock_ns(vm_clock));
|
||||
timer_mod(bs->block_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1195,13 +1195,13 @@ static void hmp_migrate_status_cb(void *opaque)
|
||||
monitor_flush(status->mon);
|
||||
}
|
||||
|
||||
qemu_mod_timer(status->timer, qemu_get_clock_ms(rt_clock) + 1000);
|
||||
timer_mod(status->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 1000);
|
||||
} else {
|
||||
if (status->is_block_migration) {
|
||||
monitor_printf(status->mon, "\n");
|
||||
}
|
||||
monitor_resume(status->mon);
|
||||
qemu_del_timer(status->timer);
|
||||
timer_del(status->timer);
|
||||
g_free(status);
|
||||
}
|
||||
|
||||
@@ -1235,9 +1235,9 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
|
||||
status = g_malloc0(sizeof(*status));
|
||||
status->mon = mon;
|
||||
status->is_block_migration = blk || inc;
|
||||
status->timer = qemu_new_timer_ms(rt_clock, hmp_migrate_status_cb,
|
||||
status->timer = timer_new_ms(QEMU_CLOCK_REALTIME, hmp_migrate_status_cb,
|
||||
status);
|
||||
qemu_mod_timer(status->timer, qemu_get_clock_ms(rt_clock));
|
||||
timer_mod(status->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -433,9 +433,9 @@ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable)
|
||||
if (enable) {
|
||||
expire_time = muldiv64(ar->tmr.overflow_time, get_ticks_per_sec(),
|
||||
PM_TIMER_FREQUENCY);
|
||||
qemu_mod_timer(ar->tmr.timer, expire_time);
|
||||
timer_mod(ar->tmr.timer, expire_time);
|
||||
} else {
|
||||
qemu_del_timer(ar->tmr.timer);
|
||||
timer_del(ar->tmr.timer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
|
||||
MemoryRegion *parent)
|
||||
{
|
||||
ar->tmr.update_sci = update_sci;
|
||||
ar->tmr.timer = qemu_new_timer_ns(vm_clock, acpi_pm_tmr_timer, ar);
|
||||
ar->tmr.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, acpi_pm_tmr_timer, ar);
|
||||
memory_region_init_io(&ar->tmr.io, memory_region_owner(parent),
|
||||
&acpi_pm_tmr_ops, ar, "acpi-tmr", 4);
|
||||
memory_region_add_subregion(parent, 8, &ar->tmr.io);
|
||||
@@ -490,7 +490,7 @@ void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
|
||||
void acpi_pm_tmr_reset(ACPIREGS *ar)
|
||||
{
|
||||
ar->tmr.overflow_time = 0;
|
||||
qemu_del_timer(ar->tmr.timer);
|
||||
timer_del(ar->tmr.timer);
|
||||
}
|
||||
|
||||
/* ACPI PM1aCNT */
|
||||
|
||||
+1
-1
@@ -833,7 +833,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
|
||||
AlphaCPU *cpu = cpus[i];
|
||||
s->cchip.cpu[i] = cpu;
|
||||
if (cpu != NULL) {
|
||||
cpu->alarm_timer = qemu_new_timer_ns(vm_clock,
|
||||
cpu->alarm_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
|
||||
typhoon_alarm_timer,
|
||||
(void *)((uintptr_t)s + i));
|
||||
}
|
||||
|
||||
+24
-24
@@ -99,7 +99,7 @@ struct omap_mpu_timer_s {
|
||||
|
||||
static inline uint32_t omap_timer_read(struct omap_mpu_timer_s *timer)
|
||||
{
|
||||
uint64_t distance = qemu_get_clock_ns(vm_clock) - timer->time;
|
||||
uint64_t distance = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - timer->time;
|
||||
|
||||
if (timer->st && timer->enable && timer->rate)
|
||||
return timer->val - muldiv64(distance >> (timer->ptv + 1),
|
||||
@@ -111,7 +111,7 @@ static inline uint32_t omap_timer_read(struct omap_mpu_timer_s *timer)
|
||||
static inline void omap_timer_sync(struct omap_mpu_timer_s *timer)
|
||||
{
|
||||
timer->val = omap_timer_read(timer);
|
||||
timer->time = qemu_get_clock_ns(vm_clock);
|
||||
timer->time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
}
|
||||
|
||||
static inline void omap_timer_update(struct omap_mpu_timer_s *timer)
|
||||
@@ -130,11 +130,11 @@ static inline void omap_timer_update(struct omap_mpu_timer_s *timer)
|
||||
* in a busy loop when it wants to sleep just a couple of CPU
|
||||
* ticks. */
|
||||
if (expires > (get_ticks_per_sec() >> 10) || timer->ar)
|
||||
qemu_mod_timer(timer->timer, timer->time + expires);
|
||||
timer_mod(timer->timer, timer->time + expires);
|
||||
else
|
||||
qemu_bh_schedule(timer->tick);
|
||||
} else
|
||||
qemu_del_timer(timer->timer);
|
||||
timer_del(timer->timer);
|
||||
}
|
||||
|
||||
static void omap_timer_fire(void *opaque)
|
||||
@@ -240,7 +240,7 @@ static const MemoryRegionOps omap_mpu_timer_ops = {
|
||||
|
||||
static void omap_mpu_timer_reset(struct omap_mpu_timer_s *s)
|
||||
{
|
||||
qemu_del_timer(s->timer);
|
||||
timer_del(s->timer);
|
||||
s->enable = 0;
|
||||
s->reset_val = 31337;
|
||||
s->val = 0;
|
||||
@@ -259,7 +259,7 @@ static struct omap_mpu_timer_s *omap_mpu_timer_init(MemoryRegion *system_memory,
|
||||
|
||||
s->irq = irq;
|
||||
s->clk = clk;
|
||||
s->timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, s);
|
||||
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, s);
|
||||
s->tick = qemu_bh_new(omap_timer_fire, s);
|
||||
omap_mpu_timer_reset(s);
|
||||
omap_timer_clk_setup(s);
|
||||
@@ -363,7 +363,7 @@ static const MemoryRegionOps omap_wd_timer_ops = {
|
||||
|
||||
static void omap_wd_timer_reset(struct omap_watchdog_timer_s *s)
|
||||
{
|
||||
qemu_del_timer(s->timer.timer);
|
||||
timer_del(s->timer.timer);
|
||||
if (!s->mode)
|
||||
omap_clk_get(s->timer.clk);
|
||||
s->mode = 1;
|
||||
@@ -388,7 +388,7 @@ static struct omap_watchdog_timer_s *omap_wd_timer_init(MemoryRegion *memory,
|
||||
|
||||
s->timer.irq = irq;
|
||||
s->timer.clk = clk;
|
||||
s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer);
|
||||
s->timer.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, &s->timer);
|
||||
omap_wd_timer_reset(s);
|
||||
omap_timer_clk_setup(&s->timer);
|
||||
|
||||
@@ -475,7 +475,7 @@ static const MemoryRegionOps omap_os_timer_ops = {
|
||||
|
||||
static void omap_os_timer_reset(struct omap_32khz_timer_s *s)
|
||||
{
|
||||
qemu_del_timer(s->timer.timer);
|
||||
timer_del(s->timer.timer);
|
||||
s->timer.enable = 0;
|
||||
s->timer.it_ena = 0;
|
||||
s->timer.reset_val = 0x00ffffff;
|
||||
@@ -494,7 +494,7 @@ static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory,
|
||||
|
||||
s->timer.irq = irq;
|
||||
s->timer.clk = clk;
|
||||
s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer);
|
||||
s->timer.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, &s->timer);
|
||||
omap_os_timer_reset(s);
|
||||
omap_timer_clk_setup(&s->timer);
|
||||
|
||||
@@ -600,7 +600,7 @@ static void omap_ulpd_pm_write(void *opaque, hwaddr addr,
|
||||
case 0x10: /* GAUGING_CTRL */
|
||||
/* Bits 0 and 1 seem to be confused in the OMAP 310 TRM */
|
||||
if ((s->ulpd_pm_regs[addr >> 2] ^ value) & 1) {
|
||||
now = qemu_get_clock_ns(vm_clock);
|
||||
now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
|
||||
if (value & 1)
|
||||
s->ulpd_gauge_start = now;
|
||||
@@ -2881,7 +2881,7 @@ static void omap_rtc_tick(void *opaque)
|
||||
if (s->auto_comp && !s->current_tm.tm_sec && !s->current_tm.tm_min)
|
||||
s->tick += s->comp_reg * 1000 / 32768;
|
||||
|
||||
qemu_mod_timer(s->clk, s->tick);
|
||||
timer_mod(s->clk, s->tick);
|
||||
}
|
||||
|
||||
static void omap_rtc_reset(struct omap_rtc_s *s)
|
||||
@@ -3009,7 +3009,7 @@ static void omap_mcbsp_source_tick(void *opaque)
|
||||
s->rx_req = s->rx_rate << bps[(s->rcr[0] >> 5) & 7];
|
||||
|
||||
omap_mcbsp_rx_newdata(s);
|
||||
qemu_mod_timer(s->source_timer, qemu_get_clock_ns(vm_clock) +
|
||||
timer_mod(s->source_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
|
||||
get_ticks_per_sec());
|
||||
}
|
||||
|
||||
@@ -3025,7 +3025,7 @@ static void omap_mcbsp_rx_start(struct omap_mcbsp_s *s)
|
||||
|
||||
static void omap_mcbsp_rx_stop(struct omap_mcbsp_s *s)
|
||||
{
|
||||
qemu_del_timer(s->source_timer);
|
||||
timer_del(s->source_timer);
|
||||
}
|
||||
|
||||
static void omap_mcbsp_rx_done(struct omap_mcbsp_s *s)
|
||||
@@ -3055,7 +3055,7 @@ static void omap_mcbsp_sink_tick(void *opaque)
|
||||
s->tx_req = s->tx_rate << bps[(s->xcr[0] >> 5) & 7];
|
||||
|
||||
omap_mcbsp_tx_newdata(s);
|
||||
qemu_mod_timer(s->sink_timer, qemu_get_clock_ns(vm_clock) +
|
||||
timer_mod(s->sink_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
|
||||
get_ticks_per_sec());
|
||||
}
|
||||
|
||||
@@ -3082,7 +3082,7 @@ static void omap_mcbsp_tx_stop(struct omap_mcbsp_s *s)
|
||||
{
|
||||
s->tx_req = 0;
|
||||
omap_mcbsp_tx_done(s);
|
||||
qemu_del_timer(s->sink_timer);
|
||||
timer_del(s->sink_timer);
|
||||
}
|
||||
|
||||
static void omap_mcbsp_req_update(struct omap_mcbsp_s *s)
|
||||
@@ -3432,8 +3432,8 @@ static void omap_mcbsp_reset(struct omap_mcbsp_s *s)
|
||||
s->rx_req = 0;
|
||||
s->tx_rate = 0;
|
||||
s->rx_rate = 0;
|
||||
qemu_del_timer(s->source_timer);
|
||||
qemu_del_timer(s->sink_timer);
|
||||
timer_del(s->source_timer);
|
||||
timer_del(s->sink_timer);
|
||||
}
|
||||
|
||||
static struct omap_mcbsp_s *omap_mcbsp_init(MemoryRegion *system_memory,
|
||||
@@ -3448,8 +3448,8 @@ static struct omap_mcbsp_s *omap_mcbsp_init(MemoryRegion *system_memory,
|
||||
s->rxirq = rxirq;
|
||||
s->txdrq = dma[0];
|
||||
s->rxdrq = dma[1];
|
||||
s->sink_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_sink_tick, s);
|
||||
s->source_timer = qemu_new_timer_ns(vm_clock, omap_mcbsp_source_tick, s);
|
||||
s->sink_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_mcbsp_sink_tick, s);
|
||||
s->source_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_mcbsp_source_tick, s);
|
||||
omap_mcbsp_reset(s);
|
||||
|
||||
memory_region_init_io(&s->iomem, NULL, &omap_mcbsp_ops, s, "omap-mcbsp", 0x800);
|
||||
@@ -3503,9 +3503,9 @@ static void omap_lpg_tick(void *opaque)
|
||||
struct omap_lpg_s *s = opaque;
|
||||
|
||||
if (s->cycle)
|
||||
qemu_mod_timer(s->tm, qemu_get_clock_ms(vm_clock) + s->period - s->on);
|
||||
timer_mod(s->tm, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + s->period - s->on);
|
||||
else
|
||||
qemu_mod_timer(s->tm, qemu_get_clock_ms(vm_clock) + s->on);
|
||||
timer_mod(s->tm, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + s->on);
|
||||
|
||||
s->cycle = !s->cycle;
|
||||
printf("%s: LED is %s\n", __FUNCTION__, s->cycle ? "on" : "off");
|
||||
@@ -3527,7 +3527,7 @@ static void omap_lpg_update(struct omap_lpg_s *s)
|
||||
per[(s->control >> 3) & 7], 256) : 0; /* ONCTRL */
|
||||
}
|
||||
|
||||
qemu_del_timer(s->tm);
|
||||
timer_del(s->tm);
|
||||
if (on == period && s->on < s->period)
|
||||
printf("%s: LED is on\n", __FUNCTION__);
|
||||
else if (on == 0 && s->on)
|
||||
@@ -3623,7 +3623,7 @@ static struct omap_lpg_s *omap_lpg_init(MemoryRegion *system_memory,
|
||||
struct omap_lpg_s *s = (struct omap_lpg_s *)
|
||||
g_malloc0(sizeof(struct omap_lpg_s));
|
||||
|
||||
s->tm = qemu_new_timer_ms(vm_clock, omap_lpg_tick, s);
|
||||
s->tm = timer_new_ms(QEMU_CLOCK_VIRTUAL, omap_lpg_tick, s);
|
||||
|
||||
omap_lpg_reset(s);
|
||||
|
||||
|
||||
+13
-13
@@ -335,7 +335,7 @@ static int pxa2xx_cpccnt_read(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
{
|
||||
PXA2xxState *s = (PXA2xxState *)ri->opaque;
|
||||
if (s->pmnc & 1) {
|
||||
*value = qemu_get_clock_ns(vm_clock);
|
||||
*value = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
} else {
|
||||
*value = 0;
|
||||
}
|
||||
@@ -870,43 +870,43 @@ static inline void pxa2xx_rtc_alarm_update(PXA2xxRTCState *s,
|
||||
uint32_t rtsr)
|
||||
{
|
||||
if ((rtsr & (1 << 2)) && !(rtsr & (1 << 0)))
|
||||
qemu_mod_timer(s->rtc_hz, s->last_hz +
|
||||
timer_mod(s->rtc_hz, s->last_hz +
|
||||
(((s->rtar - s->last_rcnr) * 1000 *
|
||||
((s->rttr & 0xffff) + 1)) >> 15));
|
||||
else
|
||||
qemu_del_timer(s->rtc_hz);
|
||||
timer_del(s->rtc_hz);
|
||||
|
||||
if ((rtsr & (1 << 5)) && !(rtsr & (1 << 4)))
|
||||
qemu_mod_timer(s->rtc_rdal1, s->last_hz +
|
||||
timer_mod(s->rtc_rdal1, s->last_hz +
|
||||
(((s->rdar1 - s->last_rdcr) * 1000 *
|
||||
((s->rttr & 0xffff) + 1)) >> 15)); /* TODO: fixup */
|
||||
else
|
||||
qemu_del_timer(s->rtc_rdal1);
|
||||
timer_del(s->rtc_rdal1);
|
||||
|
||||
if ((rtsr & (1 << 7)) && !(rtsr & (1 << 6)))
|
||||
qemu_mod_timer(s->rtc_rdal2, s->last_hz +
|
||||
timer_mod(s->rtc_rdal2, s->last_hz +
|
||||
(((s->rdar2 - s->last_rdcr) * 1000 *
|
||||
((s->rttr & 0xffff) + 1)) >> 15)); /* TODO: fixup */
|
||||
else
|
||||
qemu_del_timer(s->rtc_rdal2);
|
||||
timer_del(s->rtc_rdal2);
|
||||
|
||||
if ((rtsr & 0x1200) == 0x1200 && !(rtsr & (1 << 8)))
|
||||
qemu_mod_timer(s->rtc_swal1, s->last_sw +
|
||||
timer_mod(s->rtc_swal1, s->last_sw +
|
||||
(s->swar1 - s->last_swcr) * 10); /* TODO: fixup */
|
||||
else
|
||||
qemu_del_timer(s->rtc_swal1);
|
||||
timer_del(s->rtc_swal1);
|
||||
|
||||
if ((rtsr & 0x1800) == 0x1800 && !(rtsr & (1 << 10)))
|
||||
qemu_mod_timer(s->rtc_swal2, s->last_sw +
|
||||
timer_mod(s->rtc_swal2, s->last_sw +
|
||||
(s->swar2 - s->last_swcr) * 10); /* TODO: fixup */
|
||||
else
|
||||
qemu_del_timer(s->rtc_swal2);
|
||||
timer_del(s->rtc_swal2);
|
||||
|
||||
if ((rtsr & 0xc000) == 0xc000 && !(rtsr & (1 << 13)))
|
||||
qemu_mod_timer(s->rtc_pi, s->last_pi +
|
||||
timer_mod(s->rtc_pi, s->last_pi +
|
||||
(s->piar & 0xffff) - s->last_rtcpicr);
|
||||
else
|
||||
qemu_del_timer(s->rtc_pi);
|
||||
timer_del(s->rtc_pi);
|
||||
}
|
||||
|
||||
static inline void pxa2xx_rtc_hz_tick(void *opaque)
|
||||
|
||||
+3
-3
@@ -393,7 +393,7 @@ static void spitz_keyboard_tick(void *opaque)
|
||||
s->fifopos = 0;
|
||||
}
|
||||
|
||||
qemu_mod_timer(s->kbdtimer, qemu_get_clock_ns(vm_clock) +
|
||||
timer_mod(s->kbdtimer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
|
||||
get_ticks_per_sec() / 32);
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ static void spitz_keyboard_register(PXA2xxState *cpu)
|
||||
qdev_connect_gpio_out(cpu->gpio, spitz_gpio_key_strobe[i],
|
||||
qdev_get_gpio_in(dev, i));
|
||||
|
||||
qemu_mod_timer(s->kbdtimer, qemu_get_clock_ns(vm_clock));
|
||||
timer_mod(s->kbdtimer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
|
||||
|
||||
qemu_add_kbd_event_handler(spitz_keyboard_handler, s);
|
||||
}
|
||||
@@ -505,7 +505,7 @@ static int spitz_keyboard_init(SysBusDevice *sbd)
|
||||
|
||||
spitz_keyboard_pre_map(s);
|
||||
|
||||
s->kbdtimer = qemu_new_timer_ns(vm_clock, spitz_keyboard_tick, s);
|
||||
s->kbdtimer = timer_new_ns(QEMU_CLOCK_VIRTUAL, spitz_keyboard_tick, s);
|
||||
qdev_init_gpio_in(dev, spitz_keyboard_strobe, SPITZ_KEY_STROBE_NUM);
|
||||
qdev_init_gpio_out(dev, s->sense, SPITZ_KEY_SENSE_NUM);
|
||||
|
||||
|
||||
+5
-5
@@ -78,14 +78,14 @@ static void gptm_update_irq(gptm_state *s)
|
||||
|
||||
static void gptm_stop(gptm_state *s, int n)
|
||||
{
|
||||
qemu_del_timer(s->timer[n]);
|
||||
timer_del(s->timer[n]);
|
||||
}
|
||||
|
||||
static void gptm_reload(gptm_state *s, int n, int reset)
|
||||
{
|
||||
int64_t tick;
|
||||
if (reset)
|
||||
tick = qemu_get_clock_ns(vm_clock);
|
||||
tick = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
else
|
||||
tick = s->tick[n];
|
||||
|
||||
@@ -103,7 +103,7 @@ static void gptm_reload(gptm_state *s, int n, int reset)
|
||||
hw_error("TODO: 16-bit timer mode 0x%x\n", s->mode[n]);
|
||||
}
|
||||
s->tick[n] = tick;
|
||||
qemu_mod_timer(s->timer[n], tick);
|
||||
timer_mod(s->timer[n], tick);
|
||||
}
|
||||
|
||||
static void gptm_tick(void *opaque)
|
||||
@@ -318,8 +318,8 @@ static int stellaris_gptm_init(SysBusDevice *sbd)
|
||||
sysbus_init_mmio(sbd, &s->iomem);
|
||||
|
||||
s->opaque[0] = s->opaque[1] = s;
|
||||
s->timer[0] = qemu_new_timer_ns(vm_clock, gptm_tick, &s->opaque[0]);
|
||||
s->timer[1] = qemu_new_timer_ns(vm_clock, gptm_tick, &s->opaque[1]);
|
||||
s->timer[0] = timer_new_ns(QEMU_CLOCK_VIRTUAL, gptm_tick, &s->opaque[0]);
|
||||
s->timer[1] = timer_new_ns(QEMU_CLOCK_VIRTUAL, gptm_tick, &s->opaque[1]);
|
||||
vmstate_register(dev, -1, &vmstate_stellaris_gptm, s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+12
-12
@@ -278,17 +278,17 @@ static void strongarm_rtc_hzupdate(StrongARMRTCState *s)
|
||||
static inline void strongarm_rtc_timer_update(StrongARMRTCState *s)
|
||||
{
|
||||
if ((s->rtsr & RTSR_HZE) && !(s->rtsr & RTSR_HZ)) {
|
||||
qemu_mod_timer(s->rtc_hz, s->last_hz + 1000);
|
||||
timer_mod(s->rtc_hz, s->last_hz + 1000);
|
||||
} else {
|
||||
qemu_del_timer(s->rtc_hz);
|
||||
timer_del(s->rtc_hz);
|
||||
}
|
||||
|
||||
if ((s->rtsr & RTSR_ALE) && !(s->rtsr & RTSR_AL)) {
|
||||
qemu_mod_timer(s->rtc_alarm, s->last_hz +
|
||||
timer_mod(s->rtc_alarm, s->last_hz +
|
||||
(((s->rtar - s->last_rcnr) * 1000 *
|
||||
((s->rttr & 0xffff) + 1)) >> 15));
|
||||
} else {
|
||||
qemu_del_timer(s->rtc_alarm);
|
||||
timer_del(s->rtc_alarm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,8 +1085,8 @@ static void strongarm_uart_receive(void *opaque, const uint8_t *buf, int size)
|
||||
}
|
||||
|
||||
/* call the timeout receive callback in 3 char transmit time */
|
||||
qemu_mod_timer(s->rx_timeout_timer,
|
||||
qemu_get_clock_ns(vm_clock) + s->char_transmit_time * 3);
|
||||
timer_mod(s->rx_timeout_timer,
|
||||
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->char_transmit_time * 3);
|
||||
|
||||
strongarm_uart_update_status(s);
|
||||
strongarm_uart_update_int_status(s);
|
||||
@@ -1107,7 +1107,7 @@ static void strongarm_uart_event(void *opaque, int event)
|
||||
static void strongarm_uart_tx(void *opaque)
|
||||
{
|
||||
StrongARMUARTState *s = opaque;
|
||||
uint64_t new_xmit_ts = qemu_get_clock_ns(vm_clock);
|
||||
uint64_t new_xmit_ts = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
|
||||
if (s->utcr3 & UTCR3_LBM) /* loopback */ {
|
||||
strongarm_uart_receive(s, &s->tx_fifo[s->tx_start], 1);
|
||||
@@ -1118,7 +1118,7 @@ static void strongarm_uart_tx(void *opaque)
|
||||
s->tx_start = (s->tx_start + 1) % 8;
|
||||
s->tx_len--;
|
||||
if (s->tx_len) {
|
||||
qemu_mod_timer(s->tx_timer, new_xmit_ts + s->char_transmit_time);
|
||||
timer_mod(s->tx_timer, new_xmit_ts + s->char_transmit_time);
|
||||
}
|
||||
strongarm_uart_update_status(s);
|
||||
strongarm_uart_update_int_status(s);
|
||||
@@ -1237,8 +1237,8 @@ static int strongarm_uart_init(SysBusDevice *dev)
|
||||
sysbus_init_mmio(dev, &s->iomem);
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
|
||||
s->rx_timeout_timer = qemu_new_timer_ns(vm_clock, strongarm_uart_rx_to, s);
|
||||
s->tx_timer = qemu_new_timer_ns(vm_clock, strongarm_uart_tx, s);
|
||||
s->rx_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, strongarm_uart_rx_to, s);
|
||||
s->tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, strongarm_uart_tx, s);
|
||||
|
||||
if (s->chr) {
|
||||
qemu_chr_add_handlers(s->chr,
|
||||
@@ -1282,8 +1282,8 @@ static int strongarm_uart_post_load(void *opaque, int version_id)
|
||||
|
||||
/* restart rx timeout timer */
|
||||
if (s->rx_len) {
|
||||
qemu_mod_timer(s->rx_timeout_timer,
|
||||
qemu_get_clock_ns(vm_clock) + s->char_transmit_time * 3);
|
||||
timer_mod(s->rx_timeout_timer,
|
||||
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->char_transmit_time * 3);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ static void timer_handler (int c, double interval_Sec)
|
||||
s->ticking[n] = 1;
|
||||
#ifdef DEBUG
|
||||
interval = get_ticks_per_sec () * interval_Sec;
|
||||
exp = qemu_get_clock_ns (vm_clock) + interval;
|
||||
exp = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + interval;
|
||||
s->exp[n] = exp;
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user