kvm: qemu: notify IO thread of pending bhs
[kvm-userspace.git] / qemu / qemu-kvm.h
blobae5ce1a6b4872213f7e1ff6f3758f1cab2e810a2
1 /*
2 * qemu/kvm integration
4 * Copyright (C) 2006-2008 Qumranet Technologies
6 * Licensed under the terms of the GNU GPL version 2 or higher.
7 */
8 #ifndef QEMU_KVM_H
9 #define QEMU_KVM_H
11 #include "cpu.h"
13 int kvm_main_loop(void);
14 int kvm_qemu_init(void);
15 int kvm_qemu_create_context(void);
16 void kvm_init_new_ap(int cpu, CPUState *env);
17 int kvm_init_ap(void);
18 void kvm_qemu_destroy(void);
19 void kvm_load_registers(CPUState *env);
20 void kvm_save_registers(CPUState *env);
21 int kvm_cpu_exec(CPUState *env);
22 int kvm_update_debugger(CPUState *env);
23 int kvm_qemu_init_env(CPUState *env);
24 int kvm_qemu_check_extension(int ext);
25 void kvm_apic_init(CPUState *env);
26 int kvm_set_irq(int irq, int level);
28 int kvm_physical_memory_set_dirty_tracking(int enable);
29 int kvm_update_dirty_pages_log(void);
30 int kvm_get_phys_ram_page_bitmap(unsigned char *bitmap);
32 void qemu_kvm_call_with_env(void (*func)(void *), void *data, CPUState *env);
33 void qemu_kvm_cpuid_on_env(CPUState *env);
34 void kvm_update_after_sipi(CPUState *env);
35 void kvm_update_interrupt_request(CPUState *env);
36 void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
37 unsigned long size,
38 unsigned long phys_offset);
39 void *kvm_cpu_create_phys_mem(target_phys_addr_t start_addr,
40 unsigned long size, int log, int writable);
42 void kvm_cpu_destroy_phys_mem(target_phys_addr_t start_addr,
43 unsigned long size);
45 int kvm_arch_qemu_create_context(void);
47 void kvm_arch_save_regs(CPUState *env);
48 void kvm_arch_load_regs(CPUState *env);
49 int kvm_arch_qemu_init_env(CPUState *cenv);
50 int kvm_arch_halt(void *opaque, int vcpu);
51 void kvm_arch_pre_kvm_run(void *opaque, int vcpu);
52 void kvm_arch_post_kvm_run(void *opaque, int vcpu);
53 int kvm_arch_has_work(CPUState *env);
54 int kvm_arch_try_push_interrupts(void *opaque);
55 void kvm_arch_update_regs_for_sipi(CPUState *env);
57 CPUState *qemu_kvm_cpu_env(int index);
59 void qemu_kvm_aio_wait_start(void);
60 void qemu_kvm_aio_wait(void);
61 void qemu_kvm_aio_wait_end(void);
63 void qemu_kvm_notify_work(void);
65 void kvm_tpr_opt_setup();
66 void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write);
67 int handle_tpr_access(void *opaque, int vcpu,
68 uint64_t rip, int is_write);
69 void kvm_tpr_vcpu_start(CPUState *env);
71 int qemu_kvm_get_dirty_pages(unsigned long phys_addr, void *buf);
73 #ifdef TARGET_PPC
74 int handle_powerpc_dcr_read(int vcpu, uint32_t dcrn, uint32_t *data);
75 int handle_powerpc_dcr_write(int vcpu,uint32_t dcrn, uint32_t data);
76 #endif
78 #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1))
79 #define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS) / 8)
81 #ifdef USE_KVM
82 #include "libkvm.h"
84 extern int kvm_allowed;
85 extern kvm_context_t kvm_context;
87 #define kvm_enabled() (kvm_allowed)
88 #define qemu_kvm_irqchip_in_kernel() kvm_irqchip_in_kernel(kvm_context)
89 #define qemu_kvm_pit_in_kernel() kvm_pit_in_kernel(kvm_context)
90 #else
91 #define kvm_enabled() (0)
92 #define qemu_kvm_irqchip_in_kernel() (0)
93 #define qemu_kvm_pit_in_kernel() (0)
94 #endif
96 #endif