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 */
22 #define KVM_MAX_NUM_MEM_REGIONS 8u
25 #define KVM_MAX_NUM_MEM_REGIONS 1u
27 #define LIBKVM_S390_ORIGIN (0UL)
31 /* kvm abi verison variable */
35 * \brief The KVM context
37 * The verbose KVM context
41 /// Filedescriptor to /dev/kvm
44 int vcpu_fd
[MAX_VCPUS
];
45 struct kvm_run
*run
[MAX_VCPUS
];
46 /// Callbacks that KVM uses to emulate various unvirtualizable functionality
47 struct kvm_callbacks
*callbacks
;
49 /// is dirty pages logging enabled for all regions or not
50 int dirty_pages_log_all
;
51 /// do not create in-kernel irqchip if set
52 int no_irqchip_creation
;
53 /// in-kernel irqchip status
54 int irqchip_in_kernel
;
55 /// do not create in-kernel pit if set
57 /// in-kernel pit status
59 /// in-kernel coalesced mmio
63 void init_slots(void);
64 int get_free_slot(kvm_context_t kvm
);
65 void register_slot(int slot
, unsigned long phys_addr
, unsigned long len
,
66 int user_alloc
, unsigned long userspace_addr
, unsigned flags
);
68 void free_slot(int slot
);
69 int get_slot(unsigned long phys_addr
);
71 int kvm_alloc_kernel_memory(kvm_context_t kvm
, unsigned long memory
,
73 int kvm_alloc_userspace_memory(kvm_context_t kvm
, unsigned long memory
,
75 void *kvm_create_kernel_phys_mem(kvm_context_t kvm
, unsigned long phys_start
,
76 unsigned long len
, int log
, int writable
);
79 int kvm_arch_create(kvm_context_t kvm
, unsigned long phys_mem_bytes
,
81 int kvm_arch_create_default_phys_mem(kvm_context_t kvm
,
82 unsigned long phys_mem_bytes
,
84 int kvm_arch_run(struct kvm_run
*run
, kvm_context_t kvm
, int vcpu
);
87 void kvm_show_code(kvm_context_t kvm
, int vcpu
);
89 int handle_halt(kvm_context_t kvm
, int vcpu
);
90 int handle_shutdown(kvm_context_t kvm
, int vcpu
);
91 void post_kvm_run(kvm_context_t kvm
, int vcpu
);
92 int pre_kvm_run(kvm_context_t kvm
, int vcpu
);
93 int handle_io_window(kvm_context_t kvm
);
94 int handle_debug(kvm_context_t kvm
, int vcpu
);
95 int try_push_interrupts(kvm_context_t kvm
);