All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: Remove unused KVM helper functions
@ 2012-04-26  7:10 Jan Kiszka
  2012-04-27 22:56 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2012-04-26  7:10 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

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.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

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

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
deleted file mode 100644
index 7de51dc..0000000
--- a/qemu-kvm-x86.c
+++ /dev/null
@@ -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
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 2047ebb..34e1ac8 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -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)
 {
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 2dfdd44..713ae15 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -32,54 +32,6 @@
 
 #include "kvm.h"
 
-#if defined(__i386__) || defined(__x86_64__)
-/*!
- * \brief Get in kernel PIT of the virtual domain
- *
- * Save the PIT state.
- *
- * \param kvm Pointer to the current kvm_context
- * \param s PIT state of the virtual domain
- */
-int kvm_get_pit(KVMState *s, struct kvm_pit_state *pit_state);
-
-/*!
- * \brief Set in kernel PIT of the virtual domain
- *
- * Restore the PIT state.
- * Timer would be retriggerred after restored.
- *
- * \param kvm Pointer to the current kvm_context
- * \param s PIT state of the virtual domain
- */
-int kvm_set_pit(KVMState *s, struct kvm_pit_state *pit_state);
-
-int kvm_reinject_control(KVMState *s, int pit_reinject);
-
-/*!
- * \brief Set in kernel PIT state2 of the virtual domain
- *
- *
- * \param kvm Pointer to the current kvm_context
- * \param ps2 PIT state2 of the virtual domain
- * \return 0 on success
- */
-int kvm_set_pit2(KVMState *s, struct kvm_pit_state2 *ps2);
-
-/*!
- * \brief Get in kernel PIT state2 of the virtual domain
- *
- *
- * \param kvm Pointer to the current kvm_context
- * \param ps2 PIT state2 of the virtual domain
- * \return 0 on success
- */
-int kvm_get_pit2(KVMState *s, struct kvm_pit_state2 *ps2);
-
-#endif
-
-int kvm_enable_vapic(CPUState *env, uint64_t vapic);
-
 /*!
  * \brief Notifies host kernel about a PCI device to be assigned to a guest
  *
@@ -172,15 +124,7 @@ int kvm_assign_set_msix_nr(KVMState *s, struct kvm_assigned_msix_nr *msix_nr);
 int kvm_assign_set_msix_entry(KVMState *s,
                               struct kvm_assigned_msix_entry *entry);
 
-#else                           /* !CONFIG_KVM */
-
-struct kvm_pit_state {
-};
-
-#endif                          /* !CONFIG_KVM */
-
-void kvm_hpet_enable_kpit(void);
-void kvm_hpet_disable_kpit(void);
+#endif /* CONFIG_KVM */
 
 int kvm_add_ioport_region(unsigned long start, unsigned long size,
                           bool is_hot_plug);
@@ -191,9 +135,4 @@ int kvm_update_ioport_access(CPUState *env);
 int kvm_arch_set_ioport_access(unsigned long start, unsigned long size,
                                bool enable);
 
-int kvm_create_pit(KVMState *s);
-
-extern int kvm_pit_reinject;
-extern unsigned int kvm_shadow_memory;
-
 #endif
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 37e161f..9610b28 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -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
diff --git a/vl.c b/vl.c
index e857b68..92fbc4c 100644
--- a/vl.c
+++ b/vl.c
@@ -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();

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] qemu-kvm: Remove unused KVM helper functions
  2012-04-26  7:10 [PATCH] qemu-kvm: Remove unused KVM helper functions Jan Kiszka
@ 2012-04-27 22:56 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2012-04-27 22:56 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, kvm

On Thu, Apr 26, 2012 at 09:10:30AM +0200, Jan Kiszka wrote:
> 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.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> 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

Applied, thanks.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-27 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26  7:10 [PATCH] qemu-kvm: Remove unused KVM helper functions Jan Kiszka
2012-04-27 22:56 ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.