Skip to contentSkip to conversation

qemu-kvm: Remove unused KVM helper functions

PATCH Applied Jan Kiszka 2 participants 2 messages Apr 26, 2012 – Apr 27, 2012 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 qemu-kvm: Remove unused KVM helper functions

Removes any fragment from the original qemu-kvm PIT and some prototypes and declarations left over from previous cleanups. It also folds the function in qemu-kvm-x86.c into target-i386/kvm.c and removes the former.

---

Applies on top of
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/88006

 qemu-kvm-x86.c    |   89 -----------------------------------------------------
 qemu-kvm.c        |   36 ---------------------
 qemu-kvm.h        |   63 +-------------------------------------
 target-i386/kvm.c |   13 +++++++-
 vl.c              |    4 --
 5 files changed, 13 insertions(+), 192 deletions(-)
 delete mode 100644 qemu-kvm-x86.c
qemu-kvm-x86.c deleted +0 -89
deleted file mode 100644
index 7de51dc..0000000
@@ -1,89 +0,0 @@
-/*
- * qemu/kvm integration, x86 specific code
- *
- * Copyright (C) 2006-2008 Qumranet Technologies
- *
- * Licensed under the terms of the GNU GPL version 2 or higher.
- */
-
-#include "config.h"
-#include "config-host.h"
-
-#include <string.h>
-#include "hw/hw.h"
-#include "gdbstub.h"
-#include <sys/io.h>
-
-#include "qemu-kvm.h"
-#include <pthread.h>
-#include <sys/utsname.h>
-#include <linux/kvm_para.h>
-#include <sys/ioctl.h>
-
-#include "kvm.h"
-#include "hw/apic.h"
-
-int kvm_create_pit(KVMState *s)
-{
-    int r;
-
-    if (kvm_irqchip_in_kernel()) {
-        r = kvm_vm_ioctl(s, KVM_CREATE_PIT);
-        if (r < 0) {
-            fprintf(stderr, "Create kernel PIC irqchip failed\n");
-            return r;
-        }
-        if (!kvm_pit_reinject) {
-            r = kvm_reinject_control(s, 0);
-            if (r < 0) {
-                fprintf(stderr,
-                        "failure to disable in-kernel PIT reinjection\n");
-                return r;
-            }
-        }
-    }
-    return 0;
-}
-
-int kvm_get_pit(KVMState *s, struct kvm_pit_state *pit_state)
-{
-    if (!kvm_irqchip_in_kernel()) {
-        return 0;
-    }
-    return kvm_vm_ioctl(s, KVM_GET_PIT, pit_state);
-}
-
-int kvm_set_pit(KVMState *s, struct kvm_pit_state *pit_state)
-{
-    if (!kvm_irqchip_in_kernel()) {
-        return 0;
-    }
-    return kvm_vm_ioctl(s, KVM_SET_PIT, pit_state);
-}
-
-int kvm_get_pit2(KVMState *s, struct kvm_pit_state2 *ps2)
-{
-    if (!kvm_irqchip_in_kernel()) {
-        return 0;
-    }
-    return kvm_vm_ioctl(s, KVM_GET_PIT2, ps2);
-}
-
-int kvm_set_pit2(KVMState *s, struct kvm_pit_state2 *ps2)
-{
-    if (!kvm_irqchip_in_kernel()) {
-        return 0;
-    }
-    return kvm_vm_ioctl(s, KVM_SET_PIT2, ps2);
-}
-
-#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
-int kvm_arch_set_ioport_access(unsigned long start, unsigned long size,
-                               bool enable)
-{
-    if (ioperm(start, size, enable) < 0) {
-        return -errno;
-    }
-    return 0;
-}
-#endif
qemu-kvm.c +0 -36
index 2047ebb..34e1ac8 100644
@@ -96,22 +96,6 @@ int kvm_deassign_pci_device(KVMState *s,
 }
 #endif
 
-int kvm_reinject_control(KVMState *s, int pit_reinject)
-{
-#ifdef KVM_CAP_REINJECT_CONTROL
-    int r;
-    struct kvm_reinject_control control;
-
-    control.pit_reinject = pit_reinject;
-
-    r = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_REINJECT_CONTROL);
-    if (r > 0) {
-        return kvm_vm_ioctl(s, KVM_REINJECT_CONTROL, &control);
-    }
-#endif
-    return -ENOSYS;
-}
-
 int kvm_clear_gsi_routes(void)
 {
 #ifdef KVM_CAP_IRQ_ROUTING
@@ -332,26 +316,6 @@ int kvm_assign_set_msix_entry(KVMState *s,
 }
 #endif
 
-#ifdef TARGET_I386
-void kvm_hpet_disable_kpit(void)
-{
-    struct kvm_pit_state2 ps2;
-
-    kvm_get_pit2(kvm_state, &ps2);
-    ps2.flags |= KVM_PIT_FLAGS_HPET_LEGACY;
-    kvm_set_pit2(kvm_state, &ps2);
-}
-
-void kvm_hpet_enable_kpit(void)
-{
-    struct kvm_pit_state2 ps2;
-
-    kvm_get_pit2(kvm_state, &ps2);
-    ps2.flags &= ~KVM_PIT_FLAGS_HPET_LEGACY;
-    kvm_set_pit2(kvm_state, &ps2);
-}
-#endif
-
 #if !defined(TARGET_I386)
 int kvm_arch_init_irq_routing(void)
 {
qemu-kvm.h +1 -62

79 lines not on this page · raw message

target-i386/kvm.c +12 -1
index 37e161f..9610b28 100644
@@ -2035,4 +2035,15 @@ void kvm_arch_init_irq_routing(KVMState *s)
     }
 }
 
-#include "qemu-kvm-x86.c"
+#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
+#include <sys/io.h>
+
+int kvm_arch_set_ioport_access(unsigned long start, unsigned long size,
+                               bool enable)
+{
+    if (ioperm(start, size, enable) < 0) {
+        return -errno;
+    }
+    return 0;
+}
+#endif
vl.c +0 -4
index e857b68..92fbc4c 100644
@@ -2246,10 +2246,6 @@ static void free_and_trace(gpointer mem)
     free(mem);
 }
 
-#ifdef CONFIG_KVM_OPTIONS
-int kvm_pit_reinject = 1;
-#endif
-
 int qemu_init_main_loop(void)
 {
     return main_loop_init();
#1 lore raw
Quoted 5 lines · Jan Kiszka

Removes any fragment from the original qemu-kvm PIT and some prototypes and declarations left over from previous cleanups. It also folds the function in qemu-kvm-x86.c into target-i386/kvm.c and removes the former.

Quoted 7 lines

---

Applies on top of
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/88006

 qemu-kvm-x86.c    |   89 -----------------------------------------------------

!!!

Quoted 6 lines
 qemu-kvm.c        |   36 ---------------------
 qemu-kvm.h        |   63 +-------------------------------------
 target-i386/kvm.c |   13 +++++++-
 vl.c              |    4 --
 5 files changed, 13 insertions(+), 192 deletions(-)
 delete mode 100644 qemu-kvm-x86.c

Applied, thanks.