Commit 6f725c139ae975646c44ace77bf796318a5783da
Committed by
Anthony Liguori
1 parent
609f2fab
provide tests for pit in kernel and irqchip in kernel
KVM can have an in-kernel pit or irqchip. While we don't implement it yet, having a way for test for it (that always returns zero) will allow us to reuse code in qemu-kvm that tests for it. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
2 changed files
with
16 additions
and
0 deletions
kvm-all.c
| @@ -63,6 +63,8 @@ struct KVMState | @@ -63,6 +63,8 @@ struct KVMState | ||
| 63 | #ifdef KVM_CAP_SET_GUEST_DEBUG | 63 | #ifdef KVM_CAP_SET_GUEST_DEBUG |
| 64 | struct kvm_sw_breakpoint_head kvm_sw_breakpoints; | 64 | struct kvm_sw_breakpoint_head kvm_sw_breakpoints; |
| 65 | #endif | 65 | #endif |
| 66 | + int irqchip_in_kernel; | ||
| 67 | + int pit_in_kernel; | ||
| 66 | }; | 68 | }; |
| 67 | 69 | ||
| 68 | static KVMState *kvm_state; | 70 | static KVMState *kvm_state; |
| @@ -162,6 +164,17 @@ static void on_vcpu(CPUState *env, void (*func)(void *data), void *data) | @@ -162,6 +164,17 @@ static void on_vcpu(CPUState *env, void (*func)(void *data), void *data) | ||
| 162 | abort(); | 164 | abort(); |
| 163 | } | 165 | } |
| 164 | 166 | ||
| 167 | +int kvm_irqchip_in_kernel(void) | ||
| 168 | +{ | ||
| 169 | + return kvm_state->irqchip_in_kernel; | ||
| 170 | +} | ||
| 171 | + | ||
| 172 | +int kvm_pit_in_kernel(void) | ||
| 173 | +{ | ||
| 174 | + return kvm_state->pit_in_kernel; | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | + | ||
| 165 | int kvm_init_vcpu(CPUState *env) | 178 | int kvm_init_vcpu(CPUState *env) |
| 166 | { | 179 | { |
| 167 | KVMState *s = kvm_state; | 180 | KVMState *s = kvm_state; |
kvm.h
| @@ -60,6 +60,9 @@ int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr, | @@ -60,6 +60,9 @@ int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr, | ||
| 60 | void kvm_remove_all_breakpoints(CPUState *current_env); | 60 | void kvm_remove_all_breakpoints(CPUState *current_env); |
| 61 | int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap); | 61 | int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap); |
| 62 | 62 | ||
| 63 | +int kvm_pit_in_kernel(void); | ||
| 64 | +int kvm_irqchip_in_kernel(void); | ||
| 65 | + | ||
| 63 | /* internal API */ | 66 | /* internal API */ |
| 64 | 67 | ||
| 65 | struct KVMState; | 68 | struct KVMState; |