All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com
Subject: [PATCH 4/4] remove wrappers around ex-libkvm functions
Date: Wed, 10 Jun 2009 16:04:53 -0400	[thread overview]
Message-ID: <1244664293-9502-5-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1244664293-9502-4-git-send-email-glommer@redhat.com>

Some functions in qemu existed only to call libkvm counterparts.
Merge some of them

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 libkvm-all.h |    6 ++--
 qemu-kvm.c   |   77 ++++++++++++++-------------------------------------------
 2 files changed, 22 insertions(+), 61 deletions(-)

diff --git a/libkvm-all.h b/libkvm-all.h
index be8c855..851901d 100644
--- a/libkvm-all.h
+++ b/libkvm-all.h
@@ -96,9 +96,9 @@ int kvm_arch_run(kvm_vcpu_context_t vcpu);
 void kvm_show_code(kvm_vcpu_context_t vcpu);
 
 int handle_halt(kvm_vcpu_context_t vcpu);
-int handle_shutdown(kvm_context_t kvm, void *env);
-void post_kvm_run(kvm_context_t kvm, void *env);
-int pre_kvm_run(kvm_context_t kvm, void *env);
+int handle_shutdown(kvm_context_t kvm, CPUState *env);
+void post_kvm_run(kvm_context_t kvm, CPUState *env);
+int pre_kvm_run(kvm_context_t kvm, CPUState *env);
 int handle_io_window(kvm_context_t kvm);
 int handle_debug(kvm_vcpu_context_t vcpu, void *env);
 int try_push_interrupts(kvm_context_t kvm);
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 174e511..460bace 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -287,27 +287,6 @@ static int kvm_mmio_write(void *opaque, uint64_t addr, uint8_t *data, int len)
 	return 0;
 }
 
-static int kvm_io_window(void *opaque)
-{
-    return 1;
-}
-
-static int kvm_halt(void *opaque, kvm_vcpu_context_t vcpu)
-{
-    return kvm_arch_halt(opaque, vcpu);
-}
-
-static int kvm_shutdown(void *opaque, void *data)
-{
-    CPUState *env = (CPUState *)data;
-
-    /* stop the current vcpu from going back to guest mode */
-    env->kvm_cpu_state.stopped = 1;
-
-    qemu_system_reset_request();
-    return 1;
-}
-
 static int handle_unhandled(kvm_context_t kvm, kvm_vcpu_context_t vcpu,
                             uint64_t reason)
 {
@@ -315,34 +294,6 @@ static int handle_unhandled(kvm_context_t kvm, kvm_vcpu_context_t vcpu,
     return -EINVAL;
 }
 
-
-static int kvm_try_push_interrupts(void *opaque)
-{
-    return kvm_arch_try_push_interrupts(opaque);
-}
-
-static void kvm_post_run(void *opaque, void *data)
-{
-    CPUState *env = (CPUState *)data;
-
-    pthread_mutex_lock(&qemu_mutex);
-    kvm_arch_post_kvm_run(opaque, env);
-}
-
-static int kvm_pre_run(void *opaque, void *data)
-{
-    CPUState *env = (CPUState *)data;
-
-    kvm_arch_pre_kvm_run(opaque, env);
-
-    if (env->exit_request)
-	return 1;
-    pthread_mutex_unlock(&qemu_mutex);
-    return 0;
-}
-
-
-
 /* 
  * dirty pages logging control 
  */
@@ -1013,22 +964,26 @@ static int handle_mmio(kvm_vcpu_context_t vcpu)
 
 int handle_io_window(kvm_context_t kvm)
 {
-	return kvm_io_window(kvm->opaque);
+   return 1;
 }
 
 int handle_halt(kvm_vcpu_context_t vcpu)
 {
-	return kvm_halt(vcpu->kvm->opaque, vcpu);
+	return kvm_arch_halt(vcpu->kvm->opaque, vcpu);
 }
 
-int handle_shutdown(kvm_context_t kvm, void *env)
+int handle_shutdown(kvm_context_t kvm, CPUState *env)
 {
-	return kvm_shutdown(kvm->opaque, env);
+    /* stop the current vcpu from going back to guest mode */
+    env->kvm_cpu_state.stopped = 1;
+
+    qemu_system_reset_request();
+    return 1;
 }
 
 int try_push_interrupts(kvm_context_t kvm)
 {
-	return kvm_try_push_interrupts(kvm->opaque);
+	return kvm_arch_try_push_interrupts(kvm->opaque);
 }
 
 static inline void push_nmi(kvm_context_t kvm)
@@ -1038,14 +993,20 @@ static inline void push_nmi(kvm_context_t kvm)
 #endif /* KVM_CAP_USER_NMI */
 }
 
-void post_kvm_run(kvm_context_t kvm, void *env)
+void post_kvm_run(kvm_context_t kvm, CPUState *env)
 {
-	kvm_post_run(kvm->opaque, env);
+    pthread_mutex_lock(&qemu_mutex);
+    kvm_arch_post_kvm_run(kvm->opaque, env);
 }
 
-int pre_kvm_run(kvm_context_t kvm, void *env)
+int pre_kvm_run(kvm_context_t kvm, CPUState *env)
 {
-	return kvm_pre_run(kvm->opaque, env);
+    kvm_arch_pre_kvm_run(kvm->opaque, env);
+
+    if (env->exit_request)
+    	return 1;
+    pthread_mutex_unlock(&qemu_mutex);
+    return 0;
 }
 
 int kvm_get_interrupt_flag(kvm_vcpu_context_t vcpu)
-- 
1.5.6.6


  reply	other threads:[~2009-06-10 20:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-10 20:04 [PATCH 0/4] qemu-kvm cleanup Glauber Costa
2009-06-10 20:04 ` [PATCH 1/4] qemu-kvm.c memory cleanup Glauber Costa
2009-06-10 20:04   ` [PATCH 2/4] cleanup mmio coalescing functions Glauber Costa
2009-06-10 20:04     ` [PATCH 3/4] remove callbacks structure Glauber Costa
2009-06-10 20:04       ` Glauber Costa [this message]
2009-06-11  9:19     ` [PATCH 2/4] cleanup mmio coalescing functions Avi Kivity
2009-06-11  9:17 ` [PATCH 0/4] qemu-kvm cleanup Avi Kivity
2009-06-11  9:21   ` Avi Kivity
2009-06-11 14:31 Glauber Costa
2009-06-11 14:32 ` [PATCH 1/4] qemu-kvm.c memory cleanup Glauber Costa
2009-06-11 14:32   ` [PATCH 2/4] cleanup mmio coalescing functions Glauber Costa
2009-06-11 14:32     ` [PATCH 3/4] remove callbacks structure Glauber Costa
2009-06-11 14:32       ` [PATCH 4/4] remove wrappers around ex-libkvm functions Glauber Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244664293-9502-5-git-send-email-glommer@redhat.com \
    --to=glommer@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.