From ba45d735bda5551c55bbdd6696def10f67caf5cc Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Tue, 30 Dec 2008 15:48:58 -0200 Subject: [PATCH] kvm: libkvm: pit not reinject support [avi: adjust for kernel api changes] Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity --- libkvm/libkvm.c | 19 +++++++++++++++++++ libkvm/libkvm.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c index e15b1430..0408fdb2 100644 --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -1145,3 +1145,22 @@ int kvm_destroy_memory_region_works(kvm_context_t kvm) #endif return ret; } + +int kvm_reinject_control(kvm_context_t kvm, int pit_reinject) +{ +#ifdef KVM_CAP_REINJECT_CONTROL + int r; + struct kvm_reinject_control control; + + control.pit_reinject = pit_reinject; + + r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_REINJECT_CONTROL); + if (r > 0) { + r = ioctl(kvm->vm_fd, KVM_REINJECT_CONTROL, &control); + if (r == -1) + return -errno; + return r; + } +#endif + return -ENOSYS; +} diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h index d068fb31..ee1ba68f 100644 --- a/libkvm/libkvm.h +++ b/libkvm/libkvm.h @@ -646,6 +646,8 @@ int kvm_get_pit(kvm_context_t kvm, struct kvm_pit_state *s); int kvm_set_pit(kvm_context_t kvm, struct kvm_pit_state *s); #endif +int kvm_reinject_control(kvm_context_t kvm, int pit_reinject); + #endif #ifdef KVM_CAP_VAPIC -- 2.11.4.GIT