4 * Copyright IBM Corp. 2008
7 * Hollis Blanchard <hollisb@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
14 #include "qemu-common.h"
15 #include "qemu/timer.h"
17 #include "sysemu/device_tree.h"
19 #define PROC_DEVTREE_PATH "/proc/device-tree"
21 static QEMUTimer
*kvmppc_timer
;
22 static unsigned int kvmppc_timer_rate
;
24 static void kvmppc_timer_hack(void *opaque
)
27 qemu_mod_timer(kvmppc_timer
, qemu_get_clock_ns(vm_clock
) + kvmppc_timer_rate
);
30 void kvmppc_init(void)
32 /* XXX The only reason KVM yields control back to qemu is device IO. Since
33 * an idle guest does no IO, qemu's device model will never get a chance to
34 * run. So, until QEMU gains IO threads, we create this timer to ensure
35 * that the device model gets a chance to run. */
36 kvmppc_timer_rate
= get_ticks_per_sec() / 10;
37 kvmppc_timer
= qemu_new_timer_ns(vm_clock
, &kvmppc_timer_hack
, NULL
);
38 qemu_mod_timer(kvmppc_timer
, qemu_get_clock_ns(vm_clock
) + kvmppc_timer_rate
);