From patchwork Mon Jun 8 19:10:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 28689 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n58JAbnD019633 for ; Mon, 8 Jun 2009 19:10:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751672AbZFHTKa (ORCPT ); Mon, 8 Jun 2009 15:10:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752072AbZFHTKa (ORCPT ); Mon, 8 Jun 2009 15:10:30 -0400 Received: from mx2.redhat.com ([66.187.237.31]:49071 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751766AbZFHTKZ (ORCPT ); Mon, 8 Jun 2009 15:10:25 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n58JASm9025662 for ; Mon, 8 Jun 2009 15:10:28 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n58JAQbD025709; Mon, 8 Jun 2009 15:10:26 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n58JAPS5029961; Mon, 8 Jun 2009 15:10:26 -0400 From: Glauber Costa 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 Message-Id: <1244488224-31171-4-git-send-email-glommer@redhat.com> In-Reply-To: <1244488224-31171-3-git-send-email-glommer@redhat.com> References: <1244488224-31171-1-git-send-email-glommer@redhat.com> <1244488224-31171-2-git-send-email-glommer@redhat.com> <1244488224-31171-3-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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);