Commit bc72ad67 authored by Alex Bligh's avatar Alex Bligh Committed by Stefan Hajnoczi

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: default avatarAlex Bligh <alex@alex.org.uk>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent fe10ab54
...@@ -392,7 +392,7 @@ static void migration_bitmap_sync(void) ...@@ -392,7 +392,7 @@ static void migration_bitmap_sync(void)
} }
if (!start_time) { 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(); trace_migration_bitmap_sync_start();
...@@ -410,7 +410,7 @@ static void migration_bitmap_sync(void) ...@@ -410,7 +410,7 @@ static void migration_bitmap_sync(void)
trace_migration_bitmap_sync_end(migration_dirty_pages trace_migration_bitmap_sync_end(migration_dirty_pages
- num_dirty_pages_init); - num_dirty_pages_init);
num_dirty_pages_period += 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 */ /* more than 1 second = 1000 millisecons */
if (end_time > start_time + 1000) { if (end_time > start_time + 1000) {
...@@ -672,7 +672,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) ...@@ -672,7 +672,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
ram_control_before_iterate(f, RAM_CONTROL_ROUND); 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; i = 0;
while ((ret = qemu_file_rate_limit(f)) == 0) { while ((ret = qemu_file_rate_limit(f)) == 0) {
int bytes_sent; int bytes_sent;
...@@ -691,7 +691,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) ...@@ -691,7 +691,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
iterations iterations
*/ */
if ((i & 63) == 0) { 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) { if (t1 > MAX_WAIT) {
DPRINTF("big wait: %" PRIu64 " milliseconds, %d iterations\n", DPRINTF("big wait: %" PRIu64 " milliseconds, %d iterations\n",
t1, i); t1, i);
...@@ -1217,11 +1217,11 @@ static void check_guest_throttling(void) ...@@ -1217,11 +1217,11 @@ static void check_guest_throttling(void)
} }
if (!t0) { if (!t0) {
t0 = qemu_get_clock_ns(rt_clock); t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
return; 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 /* If it has been more than 40 ms since the last time the guest
* was throttled then do it again. * was throttled then do it again.
......
...@@ -1124,10 +1124,10 @@ static int audio_is_timer_needed (void) ...@@ -1124,10 +1124,10 @@ static int audio_is_timer_needed (void)
static void audio_reset_timer (AudioState *s) static void audio_reset_timer (AudioState *s)
{ {
if (audio_is_timer_needed ()) { 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 { else {
qemu_del_timer (s->ts); timer_del (s->ts);
} }
} }
...@@ -1834,7 +1834,7 @@ static void audio_init (void) ...@@ -1834,7 +1834,7 @@ static void audio_init (void)
QLIST_INIT (&s->cap_head); QLIST_INIT (&s->cap_head);
atexit (audio_atexit); 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) { if (!s->ts) {
hw_error("Could not create audio timer\n"); hw_error("Could not create audio timer\n");
} }
......
...@@ -46,7 +46,7 @@ static int no_run_out (HWVoiceOut *hw, int live) ...@@ -46,7 +46,7 @@ static int no_run_out (HWVoiceOut *hw, int live)
int64_t ticks; int64_t ticks;
int64_t bytes; int64_t bytes;
now = qemu_get_clock_ns (vm_clock); now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
ticks = now - no->old_ticks; ticks = now - no->old_ticks;
bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
bytes = audio_MIN (bytes, INT_MAX); bytes = audio_MIN (bytes, INT_MAX);
...@@ -102,7 +102,7 @@ static int no_run_in (HWVoiceIn *hw) ...@@ -102,7 +102,7 @@ static int no_run_in (HWVoiceIn *hw)
int samples = 0; int samples = 0;
if (dead) { 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 ticks = now - no->old_ticks;
int64_t bytes = int64_t bytes =
muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
......
...@@ -81,7 +81,7 @@ static void spice_audio_fini (void *opaque) ...@@ -81,7 +81,7 @@ static void spice_audio_fini (void *opaque)
static void rate_start (SpiceRateCtl *rate) static void rate_start (SpiceRateCtl *rate)
{ {
memset (rate, 0, sizeof (*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) 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) ...@@ -91,7 +91,7 @@ static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate)
int64_t bytes; int64_t bytes;
int64_t samples; int64_t samples;
now = qemu_get_clock_ns (vm_clock); now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
ticks = now - rate->start_ticks; ticks = now - rate->start_ticks;
bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ()); bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ());
samples = (bytes - rate->bytes_sent) >> info->shift; samples = (bytes - rate->bytes_sent) >> info->shift;
......
...@@ -52,7 +52,7 @@ static int wav_run_out (HWVoiceOut *hw, int live) ...@@ -52,7 +52,7 @@ static int wav_run_out (HWVoiceOut *hw, int live)
int rpos, decr, samples; int rpos, decr, samples;
uint8_t *dst; uint8_t *dst;
struct st_sample *src; 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 ticks = now - wav->old_ticks;
int64_t bytes = int64_t bytes =
muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
......
...@@ -315,7 +315,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len) ...@@ -315,7 +315,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
if (*cur++ != ESC) { \ if (*cur++ != ESC) { \
DPRINTF("Broken packet %#2x, tossing\n", req); \ DPRINTF("Broken packet %#2x, tossing\n", req); \
if (timer_pending(baum->cellCount_timer)) { \ if (timer_pending(baum->cellCount_timer)) { \
qemu_del_timer(baum->cellCount_timer); \ timer_del(baum->cellCount_timer); \
baum_cellCount_timer_cb(baum); \ baum_cellCount_timer_cb(baum); \
} \ } \
return (cur - 2 - buf); \ return (cur - 2 - buf); \
...@@ -334,7 +334,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len) ...@@ -334,7 +334,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
int i; int i;
/* Allow 100ms to complete the DisplayData packet */ /* 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); get_ticks_per_sec() / 10);
for (i = 0; i < baum->x * baum->y ; i++) { for (i = 0; i < baum->x * baum->y ; i++) {
EAT(c); EAT(c);
...@@ -348,7 +348,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len) ...@@ -348,7 +348,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
c = '?'; c = '?';
text[i] = c; text[i] = c;
} }
qemu_del_timer(baum->cellCount_timer); timer_del(baum->cellCount_timer);
memset(zero, 0, sizeof(zero)); memset(zero, 0, sizeof(zero));
...@@ -553,7 +553,7 @@ static void baum_close(struct CharDriverState *chr) ...@@ -553,7 +553,7 @@ static void baum_close(struct CharDriverState *chr)
{ {
BaumDriverState *baum = chr->opaque; BaumDriverState *baum = chr->opaque;
qemu_free_timer(baum->cellCount_timer); timer_free(baum->cellCount_timer);
if (baum->brlapi) { if (baum->brlapi) {
brlapi__closeConnection(baum->brlapi); brlapi__closeConnection(baum->brlapi);
g_free(baum->brlapi); g_free(baum->brlapi);
...@@ -588,7 +588,7 @@ CharDriverState *chr_baum_init(void) ...@@ -588,7 +588,7 @@ CharDriverState *chr_baum_init(void)
goto fail_handle; 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) { if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) {
brlapi_perror("baum_init: brlapi_getDisplaySize"); brlapi_perror("baum_init: brlapi_getDisplaySize");
...@@ -614,7 +614,7 @@ CharDriverState *chr_baum_init(void) ...@@ -614,7 +614,7 @@ CharDriverState *chr_baum_init(void)
return chr; return chr;
fail: fail:
qemu_free_timer(baum->cellCount_timer); timer_free(baum->cellCount_timer);
brlapi__closeConnection(handle); brlapi__closeConnection(handle);
fail_handle: fail_handle:
g_free(handle); g_free(handle);
......
...@@ -130,8 +130,8 @@ void bdrv_io_limits_disable(BlockDriverState *bs) ...@@ -130,8 +130,8 @@ void bdrv_io_limits_disable(BlockDriverState *bs)
do {} while (qemu_co_enter_next(&bs->throttled_reqs)); do {} while (qemu_co_enter_next(&bs->throttled_reqs));
if (bs->block_timer) { if (bs->block_timer) {
qemu_del_timer(bs->block_timer); timer_del(bs->block_timer);
qemu_free_timer(bs->block_timer); timer_free(bs->block_timer);
bs->block_timer = NULL; bs->block_timer = NULL;
} }
...@@ -148,7 +148,7 @@ static void bdrv_block_timer(void *opaque) ...@@ -148,7 +148,7 @@ static void bdrv_block_timer(void *opaque)
void bdrv_io_limits_enable(BlockDriverState *bs) 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; bs->io_limits_enabled = true;
} }
...@@ -180,8 +180,8 @@ static void bdrv_io_limits_intercept(BlockDriverState *bs, ...@@ -180,8 +180,8 @@ static void bdrv_io_limits_intercept(BlockDriverState *bs,
*/ */
while (bdrv_exceed_io_limits(bs, nb_sectors, is_write, &wait_time)) { while (bdrv_exceed_io_limits(bs, nb_sectors, is_write, &wait_time)) {
qemu_mod_timer(bs->block_timer, timer_mod(bs->block_timer,
wait_time + qemu_get_clock_ns(vm_clock)); wait_time + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
qemu_co_queue_wait_insert_head(&bs->throttled_reqs); qemu_co_queue_wait_insert_head(&bs->throttled_reqs);
} }
...@@ -3747,7 +3747,7 @@ static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors, ...@@ -3747,7 +3747,7 @@ static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors,
double elapsed_time; double elapsed_time;
int bps_ret, iops_ret; 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) { if (now > bs->slice_end) {
bs->slice_start = now; bs->slice_start = now;
bs->slice_end = now + BLOCK_IO_SLICE_TIME; bs->slice_end = now + BLOCK_IO_SLICE_TIME;
...@@ -3767,7 +3767,7 @@ static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors, ...@@ -3767,7 +3767,7 @@ static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors,
*wait = max_wait; *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) { if (bs->slice_end < now + max_wait) {
bs->slice_end = now + max_wait; bs->slice_end = now + max_wait;
} }
......
...@@ -960,7 +960,7 @@ static void iscsi_nop_timed_event(void *opaque) ...@@ -960,7 +960,7 @@ static void iscsi_nop_timed_event(void *opaque)
return; 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); iscsi_set_events(iscsilun);
} }
#endif #endif
...@@ -1173,8 +1173,8 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags) ...@@ -1173,8 +1173,8 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags)
#if defined(LIBISCSI_FEATURE_NOP_COUNTER) #if defined(LIBISCSI_FEATURE_NOP_COUNTER)
/* Set up a timer for sending out iSCSI NOPs */ /* Set up a timer for sending out iSCSI NOPs */
iscsilun->nop_timer = qemu_new_timer_ms(rt_clock, iscsi_nop_timed_event, iscsilun); iscsilun->nop_timer = timer_new_ms(QEMU_CLOCK_REALTIME, iscsi_nop_timed_event, iscsilun);
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);
#endif #endif
out: out:
...@@ -1204,8 +1204,8 @@ static void iscsi_close(BlockDriverState *bs) ...@@ -1204,8 +1204,8 @@ static void iscsi_close(BlockDriverState *bs)
struct iscsi_context *iscsi = iscsilun->iscsi; struct iscsi_context *iscsi = iscsilun->iscsi;
if (iscsilun->nop_timer) { if (iscsilun->nop_timer) {
qemu_del_timer(iscsilun->nop_timer); timer_del(iscsilun->nop_timer);
qemu_free_timer(iscsilun->nop_timer); timer_free(iscsilun->nop_timer);
} }
qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), NULL, NULL, NULL); qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), NULL, NULL, NULL);
iscsi_destroy_context(iscsi); iscsi_destroy_context(iscsi);
...@@ -1267,8 +1267,8 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options) ...@@ -1267,8 +1267,8 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options)
goto out; goto out;
} }
if (iscsilun->nop_timer) { if (iscsilun->nop_timer) {
qemu_del_timer(iscsilun->nop_timer); timer_del(iscsilun->nop_timer);
qemu_free_timer(iscsilun->nop_timer); timer_free(iscsilun->nop_timer);
} }
if (iscsilun->type != TYPE_DISK) { if (iscsilun->type != TYPE_DISK) {
ret = -ENODEV; ret = -ENODEV;
......
...@@ -356,7 +356,7 @@ static void coroutine_fn mirror_run(void *opaque) ...@@ -356,7 +356,7 @@ static void coroutine_fn mirror_run(void *opaque)
} }
bdrv_dirty_iter_init(bs, &s->hbi); 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 (;;) { for (;;) {
uint64_t delay_ns; uint64_t delay_ns;
int64_t cnt; int64_t cnt;
...@@ -374,7 +374,7 @@ static void coroutine_fn mirror_run(void *opaque) ...@@ -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, * We do so every SLICE_TIME nanoseconds, or when there is an error,
* or when the source is clean, whichever comes first. * 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) { s->common.iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
if (s->in_flight == MAX_IN_FLIGHT || s->buf_free_count == 0 || if (s->in_flight == MAX_IN_FLIGHT || s->buf_free_count == 0 ||
(cnt == 0 && s->in_flight > 0)) { (cnt == 0 && s->in_flight > 0)) {
...@@ -454,7 +454,7 @@ static void coroutine_fn mirror_run(void *opaque) ...@@ -454,7 +454,7 @@ static void coroutine_fn mirror_run(void *opaque)
s->common.cancelled = false; s->common.cancelled = false;
break; break;
} }
last_pause_ns = qemu_get_clock_ns(rt_clock); last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
} }
immediate_exit: immediate_exit:
......
...@@ -353,10 +353,10 @@ static void qed_start_need_check_timer(BDRVQEDState *s) ...@@ -353,10 +353,10 @@ static void qed_start_need_check_timer(BDRVQEDState *s)
{ {
trace_qed_start_need_check_timer(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. * 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); get_ticks_per_sec() * QED_NEED_CHECK_TIMEOUT);
} }
...@@ -364,7 +364,7 @@ static void qed_start_need_check_timer(BDRVQEDState *s) ...@@ -364,7 +364,7 @@ static void qed_start_need_check_timer(BDRVQEDState *s)
static void qed_cancel_need_check_timer(BDRVQEDState *s) static void qed_cancel_need_check_timer(BDRVQEDState *s)
{ {
trace_qed_cancel_need_check_timer(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) static void bdrv_qed_rebind(BlockDriverState *bs)
...@@ -494,7 +494,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags) ...@@ -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); qed_need_check_timer_cb, s);
out: out:
...@@ -518,7 +518,7 @@ static void bdrv_qed_close(BlockDriverState *bs) ...@@ -518,7 +518,7 @@ static void bdrv_qed_close(BlockDriverState *bs)
BDRVQEDState *s = bs->opaque; BDRVQEDState *s = bs->opaque;
qed_cancel_need_check_timer(s); qed_cancel_need_check_timer(s);
qemu_free_timer(s->need_check_timer); timer_free(s->need_check_timer);
/* Ensure writes reach stable storage */ /* Ensure writes reach stable storage */
bdrv_flush(bs->file); bdrv_flush(bs->file);
......
...@@ -1299,7 +1299,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, ...@@ -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); bdrv_io_limits_disable(bs);
} else { } else {
if (bs->block_timer) { 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) ...@@ -1195,13 +1195,13 @@ static void hmp_migrate_status_cb(void *opaque)
monitor_flush(status->mon); 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 { } else {
if (status->is_block_migration) { if (status->is_block_migration) {
monitor_printf(status->mon, "\n"); monitor_printf(status->mon, "\n");
} }
monitor_resume(status->mon); monitor_resume(status->mon);
qemu_del_timer(status->timer); timer_del(status->timer);
g_free(status); g_free(status);
} }
...@@ -1235,9 +1235,9 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) ...@@ -1235,9 +1235,9 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
status = g_malloc0(sizeof(*status)); status = g_malloc0(sizeof(*status));
status->mon = mon; status->mon = mon;
status->is_block_migration = blk || inc; 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); status);
qemu_mod_timer(status->timer, qemu_get_clock_ms(rt_clock)); timer_mod(status->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
} }
} }
......
...@@ -433,9 +433,9 @@ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable) ...@@ -433,9 +433,9 @@ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable)
if (enable) { if (enable) {
expire_time = muldiv64(ar->tmr.overflow_time, get_ticks_per_sec(), expire_time = muldiv64(ar->tmr.overflow_time, get_ticks_per_sec(),
PM_TIMER_FREQUENCY); PM_TIMER_FREQUENCY);
qemu_mod_timer(ar->tmr.timer, expire_time); timer_mod(ar->tmr.timer, expire_time);
} else { } 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, ...@@ -481,7 +481,7 @@ void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
MemoryRegion *parent) MemoryRegion *parent)
{ {
ar->tmr.update_sci = update_sci; 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), memory_region_init_io(&ar->tmr.io, memory_region_owner(parent),
&acpi_pm_tmr_ops, ar, "acpi-tmr", 4); &acpi_pm_tmr_ops, ar, "acpi-tmr", 4);
memory_region_add_subregion(parent, 8, &ar->tmr.io); 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, ...@@ -490,7 +490,7 @@ void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
void acpi_pm_tmr_reset(ACPIREGS *ar) void acpi_pm_tmr_reset(ACPIREGS *ar)
{ {
ar->tmr.overflow_time = 0; ar->tmr.overflow_time = 0;
qemu_del_timer(ar->tmr.timer); timer_del(ar->tmr.timer);
} }
/* ACPI PM1aCNT */ /* ACPI PM1aCNT */
......
...@@ -833,7 +833,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, ...@@ -833,7 +833,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
AlphaCPU *cpu = cpus[i]; AlphaCPU *cpu = cpus[i];
s->cchip.cpu[i] = cpu; s->cchip.cpu[i] = cpu;
if (cpu != NULL) { if (cpu != NULL) {
cpu->alarm_timer = qemu_new_timer_ns(vm_clock, cpu->alarm_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
typhoon_alarm_timer, typhoon_alarm_timer,