root / target-ppc / kvm_ppc.c @ d92aa883
History | View | Annotate | Download (1.2 kB)
1 | d76d1650 | aurel32 | /*
|
---|---|---|---|
2 | d76d1650 | aurel32 | * PowerPC KVM support
|
3 | d76d1650 | aurel32 | *
|
4 | d76d1650 | aurel32 | * Copyright IBM Corp. 2008
|
5 | d76d1650 | aurel32 | *
|
6 | d76d1650 | aurel32 | * Authors:
|
7 | d76d1650 | aurel32 | * Hollis Blanchard <hollisb@us.ibm.com>
|
8 | d76d1650 | aurel32 | *
|
9 | d76d1650 | aurel32 | * This work is licensed under the terms of the GNU GPL, version 2 or later.
|
10 | d76d1650 | aurel32 | * See the COPYING file in the top-level directory.
|
11 | d76d1650 | aurel32 | *
|
12 | d76d1650 | aurel32 | */
|
13 | d76d1650 | aurel32 | |
14 | d76d1650 | aurel32 | #include "qemu-common.h" |
15 | 1de7afc9 | Paolo Bonzini | #include "qemu/timer.h" |
16 | d76d1650 | aurel32 | #include "kvm_ppc.h" |
17 | 9c17d615 | Paolo Bonzini | #include "sysemu/device_tree.h" |
18 | 7bb438b6 | Alexander Graf | #include "qemu/main-loop.h" |
19 | d76d1650 | aurel32 | |
20 | d76d1650 | aurel32 | #define PROC_DEVTREE_PATH "/proc/device-tree" |
21 | d76d1650 | aurel32 | |
22 | d76d1650 | aurel32 | static QEMUTimer *kvmppc_timer;
|
23 | d76d1650 | aurel32 | static unsigned int kvmppc_timer_rate; |
24 | d76d1650 | aurel32 | |
25 | d76d1650 | aurel32 | static void kvmppc_timer_hack(void *opaque) |
26 | d76d1650 | aurel32 | { |
27 | 74e26c17 | Frediano Ziglio | qemu_notify_event(); |
28 | bc72ad67 | Alex Bligh | timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate); |
29 | d76d1650 | aurel32 | } |
30 | d76d1650 | aurel32 | |
31 | d76d1650 | aurel32 | void kvmppc_init(void) |
32 | d76d1650 | aurel32 | { |
33 | d76d1650 | aurel32 | /* XXX The only reason KVM yields control back to qemu is device IO. Since
|
34 | d76d1650 | aurel32 | * an idle guest does no IO, qemu's device model will never get a chance to
|
35 | 5cbdb3a3 | Stefan Weil | * run. So, until QEMU gains IO threads, we create this timer to ensure
|
36 | d76d1650 | aurel32 | * that the device model gets a chance to run. */
|
37 | 6ee093c9 | Juan Quintela | kvmppc_timer_rate = get_ticks_per_sec() / 10;
|
38 | bc72ad67 | Alex Bligh | kvmppc_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &kvmppc_timer_hack, NULL);
|
39 | bc72ad67 | Alex Bligh | timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate); |
40 | d76d1650 | aurel32 | } |