cpus: define QEMUTimerListNotifyCB for QEMU system emulation
There is no change for now, because the callback just invokes qemu_notify_event. Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
d2528bdc19
commit
3f53bc61a4
5
cpus.c
5
cpus.c
|
@ -800,6 +800,11 @@ static void qemu_cpu_kick_rr_cpu(void)
|
||||||
} while (cpu != atomic_mb_read(&tcg_current_rr_cpu));
|
} while (cpu != atomic_mb_read(&tcg_current_rr_cpu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qemu_timer_notify_cb(void *opaque, QEMUClockType type)
|
||||||
|
{
|
||||||
|
qemu_notify_event();
|
||||||
|
}
|
||||||
|
|
||||||
static void kick_tcg_thread(void *opaque)
|
static void kick_tcg_thread(void *opaque)
|
||||||
{
|
{
|
||||||
timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick());
|
timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick());
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct QEMUTimerListGroup {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void QEMUTimerCB(void *opaque);
|
typedef void QEMUTimerCB(void *opaque);
|
||||||
typedef void QEMUTimerListNotifyCB(void *opaque);
|
typedef void QEMUTimerListNotifyCB(void *opaque, QEMUClockType type);
|
||||||
|
|
||||||
struct QEMUTimer {
|
struct QEMUTimer {
|
||||||
int64_t expire_time; /* in nanoseconds */
|
int64_t expire_time; /* in nanoseconds */
|
||||||
|
@ -776,7 +776,7 @@ static inline int64_t qemu_soonest_timeout(int64_t timeout1, int64_t timeout2)
|
||||||
*
|
*
|
||||||
* Initialise the clock & timer infrastructure
|
* Initialise the clock & timer infrastructure
|
||||||
*/
|
*/
|
||||||
void init_clocks(void);
|
void init_clocks(QEMUTimerListNotifyCB *notify_cb);
|
||||||
|
|
||||||
int64_t cpu_get_ticks(void);
|
int64_t cpu_get_ticks(void);
|
||||||
/* Caller must hold BQL */
|
/* Caller must hold BQL */
|
||||||
|
|
|
@ -22,6 +22,7 @@ void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
|
||||||
|
|
||||||
/* Unblock cpu */
|
/* Unblock cpu */
|
||||||
void qemu_cpu_kick_self(void);
|
void qemu_cpu_kick_self(void);
|
||||||
|
void qemu_timer_notify_cb(void *opaque, QEMUClockType type);
|
||||||
|
|
||||||
void cpu_synchronize_all_states(void);
|
void cpu_synchronize_all_states(void);
|
||||||
void cpu_synchronize_all_post_reset(void);
|
void cpu_synchronize_all_post_reset(void);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "sysemu/cpus.h"
|
#include "sysemu/cpus.h"
|
||||||
|
#include "qemu/main-loop.h"
|
||||||
|
|
||||||
int use_icount;
|
int use_icount;
|
||||||
|
|
||||||
|
@ -9,3 +10,8 @@ int64_t cpu_get_icount(void)
|
||||||
{
|
{
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qemu_timer_notify_cb(void *opaque, QEMUClockType type)
|
||||||
|
{
|
||||||
|
qemu_notify_event();
|
||||||
|
}
|
||||||
|
|
|
@ -438,7 +438,7 @@ static void test_multi_mutex_10(void)
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
init_clocks();
|
init_clocks(NULL);
|
||||||
|
|
||||||
g_test_init(&argc, &argv, NULL);
|
g_test_init(&argc, &argv, NULL);
|
||||||
g_test_add_func("/aio/multi/lifecycle", test_lifecycle);
|
g_test_add_func("/aio/multi/lifecycle", test_lifecycle);
|
||||||
|
|
|
@ -835,7 +835,7 @@ int main(int argc, char **argv)
|
||||||
Error *local_error = NULL;
|
Error *local_error = NULL;
|
||||||
GSource *src;
|
GSource *src;
|
||||||
|
|
||||||
init_clocks();
|
init_clocks(NULL);
|
||||||
|
|
||||||
ctx = aio_context_new(&local_error);
|
ctx = aio_context_new(&local_error);
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
|
|
|
@ -351,7 +351,7 @@ void aio_notify_accept(AioContext *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aio_timerlist_notify(void *opaque)
|
static void aio_timerlist_notify(void *opaque, QEMUClockType type)
|
||||||
{
|
{
|
||||||
aio_notify(opaque);
|
aio_notify(opaque);
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ int qemu_init_main_loop(Error **errp)
|
||||||
GSource *src;
|
GSource *src;
|
||||||
Error *local_error = NULL;
|
Error *local_error = NULL;
|
||||||
|
|
||||||
init_clocks();
|
init_clocks(qemu_timer_notify_cb);
|
||||||
|
|
||||||
ret = qemu_signal_init();
|
ret = qemu_signal_init();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
@ -122,7 +122,7 @@ void timerlist_free(QEMUTimerList *timer_list)
|
||||||
g_free(timer_list);
|
g_free(timer_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qemu_clock_init(QEMUClockType type)
|
static void qemu_clock_init(QEMUClockType type, QEMUTimerListNotifyCB *notify_cb)
|
||||||
{
|
{
|
||||||
QEMUClock *clock = qemu_clock_ptr(type);
|
QEMUClock *clock = qemu_clock_ptr(type);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ static void qemu_clock_init(QEMUClockType type)
|
||||||
clock->last = INT64_MIN;
|
clock->last = INT64_MIN;
|
||||||
QLIST_INIT(&clock->timerlists);
|
QLIST_INIT(&clock->timerlists);
|
||||||
notifier_list_init(&clock->reset_notifiers);
|
notifier_list_init(&clock->reset_notifiers);
|
||||||
main_loop_tlg.tl[type] = timerlist_new(type, NULL, NULL);
|
main_loop_tlg.tl[type] = timerlist_new(type, notify_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool qemu_clock_use_for_deadline(QEMUClockType type)
|
bool qemu_clock_use_for_deadline(QEMUClockType type)
|
||||||
|
@ -278,7 +278,7 @@ QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUClockType type)
|
||||||
void timerlist_notify(QEMUTimerList *timer_list)
|
void timerlist_notify(QEMUTimerList *timer_list)
|
||||||
{
|
{
|
||||||
if (timer_list->notify_cb) {
|
if (timer_list->notify_cb) {
|
||||||
timer_list->notify_cb(timer_list->notify_opaque);
|
timer_list->notify_cb(timer_list->notify_opaque, timer_list->clock->type);
|
||||||
} else {
|
} else {
|
||||||
qemu_notify_event();
|
qemu_notify_event();
|
||||||
}
|
}
|
||||||
|
@ -635,11 +635,11 @@ void qemu_clock_unregister_reset_notifier(QEMUClockType type,
|
||||||
notifier_remove(notifier);
|
notifier_remove(notifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_clocks(void)
|
void init_clocks(QEMUTimerListNotifyCB *notify_cb)
|
||||||
{
|
{
|
||||||
QEMUClockType type;
|
QEMUClockType type;
|
||||||
for (type = 0; type < QEMU_CLOCK_MAX; type++) {
|
for (type = 0; type < QEMU_CLOCK_MAX; type++) {
|
||||||
qemu_clock_init(type);
|
qemu_clock_init(type, notify_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK
|
#ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK
|
||||||
|
|
Loading…
Reference in a new issue