From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtIcE-00029n-RY for qemu-devel@nongnu.org; Fri, 15 May 2015 12:37:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtIcD-00016k-EY for qemu-devel@nongnu.org; Fri, 15 May 2015 12:37:38 -0400 Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:36592) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtIcD-00016a-4Q for qemu-devel@nongnu.org; Fri, 15 May 2015 12:37:37 -0400 Received: by wgbhc8 with SMTP id hc8so85493655wgb.3 for ; Fri, 15 May 2015 09:37:36 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 15 May 2015 18:36:59 +0200 Message-Id: <1431707823-51230-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1431707823-51230-1-git-send-email-pbonzini@redhat.com> References: <1431707823-51230-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 3/7] kvm-all: move KVMState definitions to kvm_int.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, lersek@redhat.com, avi.kivity@gmail.com, kraxel@redhat.com i386 code will have to look inside KVMState in order to modify the address space used for KVM_SET_USER_MEM_REGION. Create an internal header so that KVMState is not exposed outside. Signed-off-by: Paolo Bonzini --- include/sysemu/kvm_int.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ kvm-all.c | 58 +-------------------------------------- 2 files changed, 71 insertions(+), 57 deletions(-) create mode 100644 include/sysemu/kvm_int.h diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h new file mode 100644 index 0000000..d5f746f --- /dev/null +++ b/include/sysemu/kvm_int.h @@ -0,0 +1,70 @@ +/* + * Internal definitions for a target's KVM support + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef QEMU_KVM_INT_H +#define QEMU_KVM_INT_H + +#include "sysemu/sysemu.h" +#include "sysemu/accel.h" +#include + +#define KVM_MSI_HASHTAB_SIZE 256 + +typedef struct KVMSlot +{ + hwaddr start_addr; + ram_addr_t memory_size; + void *ram; + int slot; + int flags; +} KVMSlot; + +struct KVMState +{ + AccelState parent_obj; + + KVMSlot *slots; + int nr_slots; + int fd; + int vmfd; + int coalesced_mmio; + struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; + bool coalesced_flush_in_progress; + int broken_set_mem_region; + int migration_log; + int vcpu_events; + int robust_singlestep; + int debugregs; +#ifdef KVM_CAP_SET_GUEST_DEBUG + struct kvm_sw_breakpoint_head kvm_sw_breakpoints; +#endif + int pit_state2; + int xsave, xcrs; + int many_ioeventfds; + int intx_set_mask; + /* The man page (and posix) say ioctl numbers are signed int, but + * they're not. Linux, glibc and *BSD all treat ioctl numbers as + * unsigned, and treating them as signed here can break things */ + unsigned irq_set_ioctl; + unsigned int sigmask_len; +#ifdef KVM_CAP_IRQ_ROUTING + struct kvm_irq_routing *irq_routes; + int nr_allocated_irq_routes; + uint32_t *used_gsi_bitmap; + unsigned int gsi_count; + QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; + bool direct_msi; +#endif +}; + +#define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm") + +#define KVM_STATE(obj) \ + OBJECT_CHECK(KVMState, (obj), TYPE_KVM_ACCEL) + +#endif diff --git a/kvm-all.c b/kvm-all.c index 8205ea1..215ed33 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -24,13 +24,11 @@ #include "qemu/atomic.h" #include "qemu/option.h" #include "qemu/config-file.h" -#include "sysemu/sysemu.h" -#include "sysemu/accel.h" #include "hw/hw.h" #include "hw/pci/msi.h" #include "hw/s390x/adapter.h" #include "exec/gdbstub.h" -#include "sysemu/kvm.h" +#include "sysemu/kvm_int.h" #include "qemu/bswap.h" #include "exec/memory.h" #include "exec/ram_addr.h" @@ -58,60 +56,6 @@ do { } while (0) #endif -#define KVM_MSI_HASHTAB_SIZE 256 - -typedef struct KVMSlot -{ - hwaddr start_addr; - ram_addr_t memory_size; - void *ram; - int slot; - int flags; -} KVMSlot; - -struct KVMState -{ - AccelState parent_obj; - - KVMSlot *slots; - int nr_slots; - int fd; - int vmfd; - int coalesced_mmio; - struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; - bool coalesced_flush_in_progress; - int broken_set_mem_region; - int migration_log; - int vcpu_events; - int robust_singlestep; - int debugregs; -#ifdef KVM_CAP_SET_GUEST_DEBUG - struct kvm_sw_breakpoint_head kvm_sw_breakpoints; -#endif - int pit_state2; - int xsave, xcrs; - int many_ioeventfds; - int intx_set_mask; - /* The man page (and posix) say ioctl numbers are signed int, but - * they're not. Linux, glibc and *BSD all treat ioctl numbers as - * unsigned, and treating them as signed here can break things */ - unsigned irq_set_ioctl; - unsigned int sigmask_len; -#ifdef KVM_CAP_IRQ_ROUTING - struct kvm_irq_routing *irq_routes; - int nr_allocated_irq_routes; - uint32_t *used_gsi_bitmap; - unsigned int gsi_count; - QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; - bool direct_msi; -#endif -}; - -#define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm") - -#define KVM_STATE(obj) \ - OBJECT_CHECK(KVMState, (obj), TYPE_KVM_ACCEL) - KVMState *kvm_state; bool kvm_kernel_irqchip; bool kvm_async_interrupts_allowed; -- 1.8.3.1