mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
qemu-timer: Introduce clock reset notifier
QEMU_CLOCK_HOST is based on the system time which may jump backward in case the admin or NTP adjusts it. RTC emulations and other device models can suffer in this case as timers will stall for the period the clock was tuned back. This adds a detection mechanism that checks on every host clock readout if the new time is before the last result. If that is the case a notifier list is informed. Device models interested in this event can register a notifier with the clock. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
committed by
Anthony Liguori
parent
9e8dd45164
commit
691a0c9c9b
@ -2,6 +2,7 @@
|
||||
#define QEMU_TIMER_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "notify.h"
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
@ -40,6 +41,10 @@ int64_t qemu_get_clock_ns(QEMUClock *clock);
|
||||
void qemu_clock_enable(QEMUClock *clock, int enabled);
|
||||
void qemu_clock_warp(QEMUClock *clock);
|
||||
|
||||
void qemu_register_clock_reset_notifier(QEMUClock *clock, Notifier *notifier);
|
||||
void qemu_unregister_clock_reset_notifier(QEMUClock *clock,
|
||||
Notifier *notifier);
|
||||
|
||||
QEMUTimer *qemu_new_timer(QEMUClock *clock, int scale,
|
||||
QEMUTimerCB *cb, void *opaque);
|
||||
void qemu_free_timer(QEMUTimer *ts);
|
||||
|
Reference in New Issue
Block a user