From patchwork Fri Feb 19 18:22:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 80789 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1JIMxCM028946 for ; Fri, 19 Feb 2010 18:23:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755388Ab0BSSWy (ORCPT ); Fri, 19 Feb 2010 13:22:54 -0500 Received: from david.siemens.de ([192.35.17.14]:15222 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755401Ab0BSSWv (ORCPT ); Fri, 19 Feb 2010 13:22:51 -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 o1JIMSwk017245; Fri, 19 Feb 2010 19:22:28 +0100 Received: from localhost.localdomain (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o1JIMRGA025400; Fri, 19 Feb 2010 19:22:28 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, Anthony Liguori , Gleb Natapov Subject: [PATCH 5/9] qemu-kvm: Use some more upstream prototypes Date: Fri, 19 Feb 2010 19:22:23 +0100 Message-Id: <5cc029ec098948741d5795c984d93a0f03ad5ce6.1266603744.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 19 Feb 2010 18:23:04 +0000 (UTC) diff --git a/kvm.h b/kvm.h index 724914d..b78e469 100644 --- a/kvm.h +++ b/kvm.h @@ -32,6 +32,7 @@ struct kvm_run; /* external API */ int kvm_init(int smp_cpus); +#endif /* KVM_UPSTREAM */ int kvm_init_vcpu(CPUState *env); @@ -41,7 +42,6 @@ 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_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); @@ -50,11 +50,11 @@ void kvm_cpu_register_phys_memory_client(void); 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); void kvm_flush_coalesced_mmio_buffer(void); +#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, @@ -64,6 +64,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 */ @@ -92,7 +93,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 @@ -126,9 +126,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 17a8080..5c4f6e6 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1919,12 +1919,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 f9c797f..1266a3f 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,9 +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); -void kvm_flush_coalesced_mmio_buffer(void); int kvm_arch_init_irq_routing(void); @@ -1022,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) @@ -1041,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) { } @@ -1056,9 +1042,6 @@ void kvm_mutex_lock(void); int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, target_phys_addr_t end_addr); -int kvm_log_start(target_phys_addr_t phys_addr, target_phys_addr_t len); -int kvm_log_stop(target_phys_addr_t phys_addr, target_phys_addr_t len); - static inline int kvm_sync_vcpus(void) { @@ -1087,7 +1070,7 @@ typedef struct KVMSlot { typedef struct kvm_dirty_log KVMDirtyLog; -typedef struct KVMState { +struct KVMState { KVMSlot slots[32]; int fd; int vmfd; @@ -1104,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);