kvm: qemu: remove hack that forced pci interrupts to be enabled
[kvm-userspace.git] / libkvm / kvm-common.h
blobf4040be667db7bfeda2ec3a9f6877f7fa262629b
1 /*
2 * This header is for functions & variables that will ONLY be
3 * used inside libkvm.
5 * derived from libkvm.c
7 * Copyright (C) 2006 Qumranet, Inc.
9 * Authors:
10 * Avi Kivity <avi@qumranet.com>
11 * Yaniv Kamay <yaniv@qumranet.com>
13 * This work is licensed under the GNU LGPL license, version 2.
16 #ifndef KVM_COMMON_H
17 #define KVM_COMMON_H
19 /* FIXME: share this number with kvm */
20 /* FIXME: or dynamically alloc/realloc regions */
21 #define KVM_MAX_NUM_MEM_REGIONS 8u
22 #define MAX_VCPUS 4
24 /* kvm abi verison variable */
25 extern int kvm_abi;
27 /**
28 * \brief The KVM context
30 * The verbose KVM context
33 struct kvm_context {
34 /// Filedescriptor to /dev/kvm
35 int fd;
36 int vm_fd;
37 int vcpu_fd[MAX_VCPUS];
38 struct kvm_run *run[MAX_VCPUS];
39 /// Callbacks that KVM uses to emulate various unvirtualizable functionality
40 struct kvm_callbacks *callbacks;
41 void *opaque;
42 /// A pointer to the memory used as the physical memory for the guest
43 void *physical_memory;
44 /// is dirty pages logging enabled for all regions or not
45 int dirty_pages_log_all;
46 /// do not create in-kernel irqchip if set
47 int no_irqchip_creation;
48 /// in-kernel irqchip status
49 int irqchip_in_kernel;
52 void init_slots(void);
53 int get_free_slot(kvm_context_t kvm);
54 void register_slot(int slot, unsigned long phys_addr, unsigned long len,
55 int user_alloc, unsigned long userspace_addr, unsigned flags);
57 void free_slot(int slot);
58 int get_slot(unsigned long phys_addr);
60 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
61 void **vm_mem);
62 int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory,
63 void **vm_mem);
64 void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start,
65 unsigned long len, int log, int writable);
68 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
69 void **vm_mem);
70 int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
71 unsigned long phys_mem_bytes,
72 void **vm_mem);
73 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu);
76 void kvm_show_code(kvm_context_t kvm, int vcpu);
78 int handle_halt(kvm_context_t kvm, int vcpu);
79 int handle_shutdown(kvm_context_t kvm, int vcpu);
80 void post_kvm_run(kvm_context_t kvm, int vcpu);
81 int pre_kvm_run(kvm_context_t kvm, int vcpu);
82 int handle_io_window(kvm_context_t kvm);
83 int handle_debug(kvm_context_t kvm, int vcpu);
84 int try_push_interrupts(kvm_context_t kvm);
86 #endif