2 * This header is for functions & variables that will ONLY be
5 * derived from libkvm.c
7 * Copyright (C) 2006 Qumranet, Inc.
10 * Avi Kivity <avi@qumranet.com>
11 * Yaniv Kamay <yaniv@qumranet.com>
13 * This work is licensed under the GNU LGPL license, version 2.
19 /* FIXME: share this number with kvm */
20 /* FIXME: or dynamically alloc/realloc regions */
21 #define KVM_MAX_NUM_MEM_REGIONS 8u
24 /* kvm abi verison variable */
28 * \brief The KVM context
30 * The verbose KVM context
34 /// Filedescriptor to /dev/kvm
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
;
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
,
62 int kvm_alloc_userspace_memory(kvm_context_t kvm
, unsigned long memory
,
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
,
70 int kvm_arch_create_default_phys_mem(kvm_context_t kvm
,
71 unsigned long phys_mem_bytes
,
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
);