[PATCH 08 of 17] Move kvm_get & kmv_set_lapci functions to libkvm-x86.c

Jerone Young
2007-11-06T16:48:49Z

# Date 1194367650 21600
# Node ID 739af911ff85420dc4bb367584a1113ca5c82551
# Parent cb186258bc6ecf05ded03d81a3d2ee820e58f605
Move kvm_get & kmv_set_lapci functions to libkvm-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -323,3 +323,34 @@ int kvm_destroy_memory_alias(kvm_context
return kvm_create_memory_alias(kvm, phys_addr, 0, 0, 0);
}

+#ifdef KVM_CAP_IRQCHIP
+
+int kvm_get_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s)
+{
+ int r;
+ if (!kvm->irqchip_in_kernel)
+ return 0;
+ r = ioctl(kvm->vcpu_fd[vcpu], KVM_GET_LAPIC, s);
+ if (r == -1) {
+ r = -errno;
+ perror("kvm_get_lapic");
+ }
+ return r;
+}
+
+int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s)
+{
+ int r;
+ if (!kvm->irqchip_in_kernel)
+ return 0;
+ r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_LAPIC, s);
+ if (r == -1) {
+ r = -errno;
+ perror("kvm_set_lapic");
+ }
+ return r;
+}
+
+#endif
+
+
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -636,32 +636,6 @@ int kvm_set_irqchip(kvm_context_t kvm, s
if (r == -1) {
r = -errno;
perror("kvm_set_irqchip\n");
- }
- return r;
-}
-
-int kvm_get_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s)
-{
- int r;
- if (!kvm->irqchip_in_kernel)
- return 0;
- r = ioctl(kvm->vcpu_fd[vcpu], KVM_GET_LAPIC, s);
- if (r == -1) {
- r = -errno;
- perror("kvm_get_lapic");
- }
- return r;
-}
-
-int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s)
-{
- int r;
- if (!kvm->irqchip_in_kernel)
- return 0;
- r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_LAPIC, s);
- if (r == -1) {
- r = -errno;
- perror("kvm_set_lapic");
}
return r;