aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kvm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kvm.h')
-rw-r--r--include/linux/kvm.h130
1 files changed, 129 insertions, 1 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index c1ec04fd000d..a281afeddfbb 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -8,11 +8,18 @@
8 */ 8 */
9 9
10#include <asm/types.h> 10#include <asm/types.h>
11#include <linux/compiler.h>
11#include <linux/ioctl.h> 12#include <linux/ioctl.h>
12#include <asm/kvm.h> 13#include <asm/kvm.h>
13 14
14#define KVM_API_VERSION 12 15#define KVM_API_VERSION 12
15 16
17/* for KVM_TRACE_ENABLE */
18struct kvm_user_trace_setup {
19 __u32 buf_size; /* sub_buffer size of each per-cpu */
20 __u32 buf_nr; /* the number of sub_buffers of each per-cpu */
21};
22
16/* for KVM_CREATE_MEMORY_REGION */ 23/* for KVM_CREATE_MEMORY_REGION */
17struct kvm_memory_region { 24struct kvm_memory_region {
18 __u32 slot; 25 __u32 slot;
@@ -73,6 +80,9 @@ struct kvm_irqchip {
73#define KVM_EXIT_INTR 10 80#define KVM_EXIT_INTR 10
74#define KVM_EXIT_SET_TPR 11 81#define KVM_EXIT_SET_TPR 11
75#define KVM_EXIT_TPR_ACCESS 12 82#define KVM_EXIT_TPR_ACCESS 12
83#define KVM_EXIT_S390_SIEIC 13
84#define KVM_EXIT_S390_RESET 14
85#define KVM_EXIT_DCR 15
76 86
77/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 87/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
78struct kvm_run { 88struct kvm_run {
@@ -137,6 +147,27 @@ struct kvm_run {
137 __u32 is_write; 147 __u32 is_write;
138 __u32 pad; 148 __u32 pad;
139 } tpr_access; 149 } tpr_access;
150 /* KVM_EXIT_S390_SIEIC */
151 struct {
152 __u8 icptcode;
153 __u64 mask; /* psw upper half */
154 __u64 addr; /* psw lower half */
155 __u16 ipa;
156 __u32 ipb;
157 } s390_sieic;
158 /* KVM_EXIT_S390_RESET */
159#define KVM_S390_RESET_POR 1
160#define KVM_S390_RESET_CLEAR 2
161#define KVM_S390_RESET_SUBSYSTEM 4
162#define KVM_S390_RESET_CPU_INIT 8
163#define KVM_S390_RESET_IPL 16
164 __u64 s390_reset_flags;
165 /* KVM_EXIT_DCR */
166 struct {
167 __u32 dcrn;
168 __u32 data;
169 __u8 is_write;
170 } dcr;
140 /* Fix the size of the union. */ 171 /* Fix the size of the union. */
141 char padding[256]; 172 char padding[256];
142 }; 173 };
@@ -204,6 +235,74 @@ struct kvm_vapic_addr {
204 __u64 vapic_addr; 235 __u64 vapic_addr;
205}; 236};
206 237
238/* for KVM_SET_MPSTATE */
239
240#define KVM_MP_STATE_RUNNABLE 0
241#define KVM_MP_STATE_UNINITIALIZED 1
242#define KVM_MP_STATE_INIT_RECEIVED 2
243#define KVM_MP_STATE_HALTED 3
244#define KVM_MP_STATE_SIPI_RECEIVED 4
245
246struct kvm_mp_state {
247 __u32 mp_state;
248};
249
250struct kvm_s390_psw {
251 __u64 mask;
252 __u64 addr;
253};
254
255/* valid values for type in kvm_s390_interrupt */
256#define KVM_S390_SIGP_STOP 0xfffe0000u
257#define KVM_S390_PROGRAM_INT 0xfffe0001u
258#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u
259#define KVM_S390_RESTART 0xfffe0003u
260#define KVM_S390_INT_VIRTIO 0xffff2603u
261#define KVM_S390_INT_SERVICE 0xffff2401u
262#define KVM_S390_INT_EMERGENCY 0xffff1201u
263
264struct kvm_s390_interrupt {
265 __u32 type;
266 __u32 parm;
267 __u64 parm64;
268};
269
270#define KVM_TRC_SHIFT 16
271/*
272 * kvm trace categories
273 */
274#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT)
275#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) /* only 12 bits */
276
277/*
278 * kvm trace action
279 */
280#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01)
281#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02)
282#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01)
283
284#define KVM_TRC_HEAD_SIZE 12
285#define KVM_TRC_CYCLE_SIZE 8
286#define KVM_TRC_EXTRA_MAX 7
287
288/* This structure represents a single trace buffer record. */
289struct kvm_trace_rec {
290 __u32 event:28;
291 __u32 extra_u32:3;
292 __u32 cycle_in:1;
293 __u32 pid;
294 __u32 vcpu_id;
295 union {
296 struct {
297 __u32 cycle_lo, cycle_hi;
298 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
299 } cycle;
300 struct {
301 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
302 } nocycle;
303 } u;
304};
305
207#define KVMIO 0xAE 306#define KVMIO 0xAE
208 307
209/* 308/*
@@ -212,6 +311,8 @@ struct kvm_vapic_addr {
212#define KVM_GET_API_VERSION _IO(KVMIO, 0x00) 311#define KVM_GET_API_VERSION _IO(KVMIO, 0x00)
213#define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ 312#define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */
214#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) 313#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list)
314
315#define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06)
215/* 316/*
216 * Check if a kvm extension is available. Argument is extension number, 317 * Check if a kvm extension is available. Argument is extension number,
217 * return is 1 (yes) or 0 (no, sorry). 318 * return is 1 (yes) or 0 (no, sorry).
@@ -222,7 +323,12 @@ struct kvm_vapic_addr {
222 */ 323 */
223#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ 324#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */
224#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) 325#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
225 326/*
327 * ioctls for kvm trace
328 */
329#define KVM_TRACE_ENABLE _IOW(KVMIO, 0x06, struct kvm_user_trace_setup)
330#define KVM_TRACE_PAUSE _IO(KVMIO, 0x07)
331#define KVM_TRACE_DISABLE _IO(KVMIO, 0x08)
226/* 332/*
227 * Extension capability list. 333 * Extension capability list.
228 */ 334 */
@@ -233,6 +339,13 @@ struct kvm_vapic_addr {
233#define KVM_CAP_SET_TSS_ADDR 4 339#define KVM_CAP_SET_TSS_ADDR 4
234#define KVM_CAP_VAPIC 6 340#define KVM_CAP_VAPIC 6
235#define KVM_CAP_EXT_CPUID 7 341#define KVM_CAP_EXT_CPUID 7
342#define KVM_CAP_CLOCKSOURCE 8
343#define KVM_CAP_NR_VCPUS 9 /* returns max vcpus per vm */
344#define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */
345#define KVM_CAP_PIT 11
346#define KVM_CAP_NOP_IO_DELAY 12
347#define KVM_CAP_PV_MMU 13
348#define KVM_CAP_MP_STATE 14
236 349
237/* 350/*
238 * ioctls for VM fds 351 * ioctls for VM fds
@@ -255,6 +368,9 @@ struct kvm_vapic_addr {
255#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 368#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
256#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) 369#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip)
257#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) 370#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip)
371#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
372#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
373#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
258 374
259/* 375/*
260 * ioctls for vcpu fds 376 * ioctls for vcpu fds
@@ -281,5 +397,17 @@ struct kvm_vapic_addr {
281#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) 397#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
282/* Available with KVM_CAP_VAPIC */ 398/* Available with KVM_CAP_VAPIC */
283#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) 399#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
400/* valid for virtual machine (for floating interrupt)_and_ vcpu */
401#define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt)
402/* store status for s390 */
403#define KVM_S390_STORE_STATUS_NOADDR (-1ul)
404#define KVM_S390_STORE_STATUS_PREFIXED (-2ul)
405#define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long)
406/* initial ipl psw for s390 */
407#define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw)
408/* initial reset for s390 */
409#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
410#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
411#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
284 412
285#endif 413#endif