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 3/4] Move KVMState to common header
Date: Mon,  8 Jun 2009 15:10:23 -0400	[thread overview]
Message-ID: <1244488224-31171-4-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1244488224-31171-3-git-send-email-glommer@redhat.com>

This patch should be applied to main qemu, but I'll
first post it here for appreciation. In this patch,
we move KVMState definition to kvm.h header. With this
done, we can also use its definition in our files, until
there is no more such thing as "our" files. This is too
selfish anyway.

Later on, we'll move our internal state inside it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 kvm-all.c  |   21 ---------------------
 kvm.h      |   40 +++++++++++++++++++++++++++++++---------
 qemu-kvm.h |    8 --------
 3 files changed, 31 insertions(+), 38 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index c89e3b1..d60126c 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -39,32 +39,11 @@
     do { } while (0)
 #endif
 
-typedef struct KVMSlot
-{
-    target_phys_addr_t start_addr;
-    ram_addr_t memory_size;
-    ram_addr_t phys_offset;
-    int slot;
-    int flags;
-} KVMSlot;
 
 typedef struct kvm_dirty_log KVMDirtyLog;
 
 int kvm_allowed = 0;
 
-struct KVMState
-{
-    KVMSlot slots[32];
-    int fd;
-    int vmfd;
-    int coalesced_mmio;
-    int broken_set_mem_region;
-    int migration_log;
-#ifdef KVM_CAP_SET_GUEST_DEBUG
-    struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
-#endif
-};
-
 static KVMState *kvm_state;
 
 static KVMSlot *kvm_alloc_slot(KVMState *s)
diff --git a/kvm.h b/kvm.h
index e1c6eba..553c03e 100644
--- a/kvm.h
+++ b/kvm.h
@@ -18,6 +18,37 @@
 #include "sys-queue.h"
 #include "libkvm-all.h"
 
+typedef struct KVMSlot
+{
+    target_phys_addr_t start_addr;
+    ram_addr_t memory_size;
+    ram_addr_t phys_offset;
+    int slot;
+    int flags;
+} KVMSlot;
+
+struct kvm_sw_breakpoint {
+    target_ulong pc;
+    target_ulong saved_insn;
+    int use_count;
+    TAILQ_ENTRY(kvm_sw_breakpoint) entry;
+};
+
+TAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint);
+
+struct KVMState
+{
+    KVMSlot slots[32];
+    int fd;
+    int vmfd;
+    int coalesced_mmio;
+    int broken_set_mem_region;
+    int migration_log;
+#ifdef KVM_CAP_SET_GUEST_DEBUG
+    struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
+#endif
+};
+
 #ifdef KVM_UPSTREAM
 
 #ifdef CONFIG_KVM
@@ -97,15 +128,6 @@ int kvm_arch_init_vcpu(CPUState *env);
 struct kvm_guest_debug;
 struct kvm_debug_exit_arch;
 
-struct kvm_sw_breakpoint {
-    target_ulong pc;
-    target_ulong saved_insn;
-    int use_count;
-    TAILQ_ENTRY(kvm_sw_breakpoint) entry;
-};
-
-TAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint);
-
 int kvm_arch_debug(struct kvm_debug_exit_arch *arch_info);
 
 struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *env,
diff --git a/qemu-kvm.h b/qemu-kvm.h
index fa40542..88bbba4 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -81,14 +81,6 @@ void kvm_arch_cpu_reset(CPUState *env);
 struct kvm_guest_debug;
 struct kvm_debug_exit_arch;
 
-struct kvm_sw_breakpoint {
-    target_ulong pc;
-    target_ulong saved_insn;
-    int use_count;
-    TAILQ_ENTRY(kvm_sw_breakpoint) entry;
-};
-TAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint);
-
 extern struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
 
 int kvm_arch_debug(struct kvm_debug_exit_arch *arch_info);
-- 
1.5.6.6


  reply	other threads:[~2009-06-08 19:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 19:10 [PATCH 0/4] Start using KVMState Glauber Costa
2009-06-08 19:10 ` [PATCH 1/4] get rid of libkvm-common.h Glauber Costa
2009-06-08 19:10   ` [PATCH 2/4] pull qemu headers into libkvm Glauber Costa
2009-06-08 19:10     ` Glauber Costa [this message]
2009-06-08 19:10       ` [PATCH 4/4] Use KVMState as main state container Glauber Costa
2009-06-08 19:54       ` [PATCH 3/4] Move KVMState to common header Jan Kiszka
2009-06-08 20:14         ` Glauber Costa
2009-06-08 22:01           ` Anthony Liguori
2009-06-18  9:15 ` [PATCH 0/4] Start using KVMState Avi Kivity
2009-06-18 13:29   ` 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=1244488224-31171-4-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.