From patchwork Wed Feb 3 08:53:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 44359 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A33DBB7D11 for ; Wed, 3 Feb 2010 20:21:03 +1100 (EST) Received: from localhost ([127.0.0.1]:42607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcbPw-0001K6-HR for incoming@patchwork.ozlabs.org; Wed, 03 Feb 2010 04:21:00 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ncazz-00021u-Q8 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:54:12 -0500 Received: from [199.232.76.173] (port=56387 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ncazx-00020V-VS for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:54:10 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Ncazk-00078a-Q0 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:54:09 -0500 Received: from mx20.gnu.org ([199.232.41.8]:46398) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ncazj-00077t-OA for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:53:56 -0500 Received: from david.siemens.de ([192.35.17.14]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ncazh-0001Mf-E2 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:53:53 -0500 Received: from mail3.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o138rptt031117; Wed, 3 Feb 2010 09:53:51 +0100 Received: from localhost.localdomain ([139.25.173.28]) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o138rkC8012112; Wed, 3 Feb 2010 09:53:50 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Wed, 3 Feb 2010 09:53:32 +0100 Message-Id: <485f633a3f4a56438ca38023671aef3e2296b9cd.1265187223.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Anthony Liguori , Glauber Costa , Alexander Graf , kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v2 07/21] qemu-kvm: Use some more upstream prototypes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Drop our private typedef of KVMState and use more identical upstream prototypes. Signed-off-by: Jan Kiszka --- kvm.h | 10 +++++++--- qemu-kvm.c | 4 +++- qemu-kvm.h | 24 +++--------------------- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/kvm.h b/kvm.h index 05ee540..b5ed744 100644 --- a/kvm.h +++ b/kvm.h @@ -32,11 +32,13 @@ struct kvm_run; /* external API */ int kvm_init(int smp_cpus); +#endif /* KVM_UPSTREAM */ int kvm_init_vcpu(CPUState *env); int kvm_cpu_exec(CPUState *env); +#ifdef KVM_UPSTREAM void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset); @@ -47,19 +49,19 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, int kvm_log_start(target_phys_addr_t phys_addr, ram_addr_t size); int kvm_log_stop(target_phys_addr_t phys_addr, ram_addr_t size); int kvm_set_migration_log(int enable); +#endif /* KVM_UPSTREAM */ int kvm_has_sync_mmu(void); -#endif /* KVM_UPSTREAM */ int kvm_has_vcpu_events(void); int kvm_put_vcpu_events(CPUState *env); int kvm_get_vcpu_events(CPUState *env); void kvm_setup_guest_memory(void *start, size_t size); -#ifdef KVM_UPSTREAM int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size); int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size); +#ifdef KVM_UPSTREAM int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr, target_ulong len, int type); int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr, @@ -69,6 +71,7 @@ int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap); int kvm_pit_in_kernel(void); int kvm_irqchip_in_kernel(void); +#endif /* KVM_UPSTREAM */ /* internal API */ @@ -97,7 +100,6 @@ int kvm_arch_init(KVMState *s, int smp_cpus); int kvm_arch_init_vcpu(CPUState *env); -#endif void kvm_arch_reset_vcpu(CPUState *env); #ifdef KVM_UPSTREAM @@ -131,9 +133,11 @@ int kvm_arch_remove_hw_breakpoint(target_ulong addr, void kvm_arch_remove_all_hw_breakpoints(void); void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg); +#endif int kvm_check_extension(KVMState *s, unsigned int extension); +#ifdef KVM_UPSTREAM uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg); #endif diff --git a/qemu-kvm.c b/qemu-kvm.c index b153ee1..a8f02fc 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1909,12 +1909,14 @@ static void *ap_main_loop(void *_env) return NULL; } -void kvm_init_vcpu(CPUState *env) +int kvm_init_vcpu(CPUState *env) { pthread_create(&env->kvm_cpu_state.thread, NULL, ap_main_loop, env); while (env->created == 0) qemu_cond_wait(&qemu_vcpu_cond); + + return 0; } int kvm_vcpu_inited(CPUState *env) diff --git a/qemu-kvm.h b/qemu-kvm.h index de00763..b34b39f 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -891,7 +891,6 @@ int kvm_init_ap(void); int kvm_vcpu_inited(CPUState *env); void kvm_load_mpstate(CPUState *env); void kvm_save_mpstate(CPUState *env); -int kvm_cpu_exec(CPUState *env); int kvm_insert_breakpoint(CPUState * current_env, target_ulong addr, target_ulong len, int type); int kvm_remove_breakpoint(CPUState * current_env, target_ulong addr, @@ -933,9 +932,6 @@ void kvm_arch_save_regs(CPUState *env); void kvm_arch_load_regs(CPUState *env); void kvm_arch_load_mpstate(CPUState *env); void kvm_arch_save_mpstate(CPUState *env); -int kvm_arch_init_vcpu(CPUState *cenv); -int kvm_arch_pre_run(CPUState *env, struct kvm_run *run); -int kvm_arch_post_run(CPUState *env, struct kvm_run *run); int kvm_arch_has_work(CPUState *env); void kvm_arch_process_irqchip_events(CPUState *env); int kvm_arch_try_push_interrupts(void *opaque); @@ -981,8 +977,6 @@ void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write); void kvm_tpr_vcpu_start(CPUState *env); int qemu_kvm_get_dirty_pages(unsigned long phys_addr, void *buf); -int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size); -int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size); int kvm_arch_init_irq_routing(void); @@ -1021,17 +1015,14 @@ void qemu_kvm_cpu_stop(CPUState *env); int kvm_arch_halt(CPUState *env); int handle_tpr_access(void *opaque, CPUState *env, uint64_t rip, int is_write); -int kvm_has_sync_mmu(void); #define qemu_kvm_pit_in_kernel() kvm_pit_in_kernel(kvm_context) #define qemu_kvm_has_gsi_routing() kvm_has_gsi_routing(kvm_context) #ifdef TARGET_I386 #define qemu_kvm_has_pit_state2() kvm_has_pit_state2(kvm_context) #endif -void kvm_init_vcpu(CPUState *env); void kvm_load_tsc(CPUState *env); #else -#define kvm_has_sync_mmu() (0) #define kvm_nested 0 #define qemu_kvm_pit_in_kernel() (0) #define qemu_kvm_has_gsi_routing() (0) @@ -1040,10 +1031,6 @@ void kvm_load_tsc(CPUState *env); #endif #define kvm_save_mpstate(env) do {} while(0) #define qemu_kvm_cpu_stop(env) do {} while(0) -static inline void kvm_init_vcpu(CPUState *env) -{ -} - static inline void kvm_load_tsc(CPUState *env) { } @@ -1086,7 +1073,7 @@ typedef struct KVMSlot { typedef struct kvm_dirty_log KVMDirtyLog; -typedef struct KVMState { +struct KVMState { KVMSlot slots[32]; int fd; int vmfd; @@ -1100,14 +1087,9 @@ typedef struct KVMState { int irqchip_in_kernel; struct kvm_context kvm_context; -} KVMState; - -extern KVMState *kvm_state; +}; -int kvm_ioctl(KVMState *s, int type, ...); -int kvm_vm_ioctl(KVMState *s, int type, ...); -int kvm_vcpu_ioctl(CPUState *env, int type, ...); -int kvm_check_extension(KVMState *s, unsigned int ext); +extern struct KVMState *kvm_state; int kvm_tpr_enable_vapic(CPUState *env);