ehci: fix segfault when hot-unplugging ehci controller
[qemu/ar7.git] / target-ppc / kvm_ppc.c
blobf769acd44c4fd1742020d30e29194968c0819283
1 /*
2 * PowerPC KVM support
4 * Copyright IBM Corp. 2008
6 * Authors:
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"
16 #include "kvm_ppc.h"
17 #include "sysemu/device_tree.h"
18 #include "qemu/main-loop.h"
20 #define PROC_DEVTREE_PATH "/proc/device-tree"
22 static QEMUTimer *kvmppc_timer;
23 static unsigned int kvmppc_timer_rate;
25 static void kvmppc_timer_hack(void *opaque)
27 qemu_notify_event();
28 timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate);
31 void kvmppc_init(void)
33 /* XXX The only reason KVM yields control back to qemu is device IO. Since
34 * an idle guest does no IO, qemu's device model will never get a chance to
35 * run. So, until QEMU gains IO threads, we create this timer to ensure
36 * that the device model gets a chance to run. */
37 kvmppc_timer_rate = get_ticks_per_sec() / 10;
38 kvmppc_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &kvmppc_timer_hack, NULL);
39 timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate);