]> git.proxmox.com Git - qemu.git/blame - target-ppc/kvm_ppc.c
aio / timers: Switch entire codebase to the new timer API
[qemu.git] / target-ppc / kvm_ppc.c
CommitLineData
d76d1650
AJ
1/*
2 * PowerPC KVM support
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * Authors:
7 * Hollis Blanchard <hollisb@us.ibm.com>
8 *
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.
11 *
12 */
13
14#include "qemu-common.h"
1de7afc9 15#include "qemu/timer.h"
d76d1650 16#include "kvm_ppc.h"
9c17d615 17#include "sysemu/device_tree.h"
d76d1650
AJ
18
19#define PROC_DEVTREE_PATH "/proc/device-tree"
20
21static QEMUTimer *kvmppc_timer;
22static unsigned int kvmppc_timer_rate;
23
d76d1650
AJ
24static void kvmppc_timer_hack(void *opaque)
25{
74e26c17 26 qemu_notify_event();
bc72ad67 27 timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate);
d76d1650
AJ
28}
29
30void kvmppc_init(void)
31{
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
5cbdb3a3 34 * run. So, until QEMU gains IO threads, we create this timer to ensure
d76d1650 35 * that the device model gets a chance to run. */
6ee093c9 36 kvmppc_timer_rate = get_ticks_per_sec() / 10;
bc72ad67
AB
37 kvmppc_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &kvmppc_timer_hack, NULL);
38 timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate);
d76d1650
AJ
39}
40