Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 1 | #ifndef __LINUX_KVM_H |
| 2 | #define __LINUX_KVM_H |
| 3 | |
| 4 | /* |
| 5 | * Userspace interface for /dev/kvm - kernel based virtual machine |
| 6 | * |
Rusty Russell | dea8cae | 2007-07-17 23:12:26 +1000 | [diff] [blame] | 7 | * Note: you must update KVM_API_VERSION if you change this interface. |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <asm/types.h> |
| 11 | #include <linux/ioctl.h> |
| 12 | |
Avi Kivity | 2ff81f7 | 2007-04-29 16:25:49 +0300 | [diff] [blame] | 13 | #define KVM_API_VERSION 12 |
Avi Kivity | 0b76e20 | 2006-12-22 01:06:02 -0800 | [diff] [blame] | 14 | |
Rusty Russell | 9eb829c | 2007-07-18 13:05:58 +1000 | [diff] [blame] | 15 | /* Architectural interrupt line count. */ |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 16 | #define KVM_NR_INTERRUPTS 256 |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 17 | |
| 18 | /* for KVM_CREATE_MEMORY_REGION */ |
| 19 | struct kvm_memory_region { |
| 20 | __u32 slot; |
| 21 | __u32 flags; |
| 22 | __u64 guest_phys_addr; |
| 23 | __u64 memory_size; /* bytes */ |
| 24 | }; |
| 25 | |
Izik Eidus | 6fc138d | 2007-10-09 19:20:39 +0200 | [diff] [blame^] | 26 | /* for KVM_SET_USER_MEMORY_REGION */ |
| 27 | struct kvm_userspace_memory_region { |
| 28 | __u32 slot; |
| 29 | __u32 flags; |
| 30 | __u64 guest_phys_addr; |
| 31 | __u64 memory_size; /* bytes */ |
| 32 | __u64 userspace_addr; /* start of the userspace allocated memory */ |
| 33 | }; |
| 34 | |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 35 | /* for kvm_memory_region::flags */ |
| 36 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL |
| 37 | |
Avi Kivity | e820754 | 2007-03-30 16:54:30 +0300 | [diff] [blame] | 38 | struct kvm_memory_alias { |
| 39 | __u32 slot; /* this has a different namespace than memory slots */ |
| 40 | __u32 flags; |
| 41 | __u64 guest_phys_addr; |
| 42 | __u64 memory_size; |
| 43 | __u64 target_phys_addr; |
| 44 | }; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 45 | |
Eddie Dong | 97222cc | 2007-09-12 10:58:04 +0300 | [diff] [blame] | 46 | /* for KVM_IRQ_LINE */ |
Eddie Dong | 85f455f | 2007-07-06 12:20:49 +0300 | [diff] [blame] | 47 | struct kvm_irq_level { |
| 48 | /* |
| 49 | * ACPI gsi notion of irq. |
| 50 | * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. |
| 51 | * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. |
| 52 | */ |
| 53 | __u32 irq; |
| 54 | __u32 level; |
| 55 | }; |
| 56 | |
He, Qing | 6bf9e96 | 2007-08-05 10:49:16 +0300 | [diff] [blame] | 57 | /* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */ |
He, Qing | 6ceb9d7 | 2007-07-26 11:05:18 +0300 | [diff] [blame] | 58 | struct kvm_pic_state { |
| 59 | __u8 last_irr; /* edge detection */ |
| 60 | __u8 irr; /* interrupt request register */ |
| 61 | __u8 imr; /* interrupt mask register */ |
| 62 | __u8 isr; /* interrupt service register */ |
| 63 | __u8 priority_add; /* highest irq priority */ |
| 64 | __u8 irq_base; |
| 65 | __u8 read_reg_select; |
| 66 | __u8 poll; |
| 67 | __u8 special_mask; |
| 68 | __u8 init_state; |
| 69 | __u8 auto_eoi; |
| 70 | __u8 rotate_on_auto_eoi; |
| 71 | __u8 special_fully_nested_mode; |
| 72 | __u8 init4; /* true if 4 byte init */ |
| 73 | __u8 elcr; /* PIIX edge/trigger selection */ |
| 74 | __u8 elcr_mask; |
| 75 | }; |
| 76 | |
He, Qing | 6bf9e96 | 2007-08-05 10:49:16 +0300 | [diff] [blame] | 77 | #define KVM_IOAPIC_NUM_PINS 24 |
| 78 | struct kvm_ioapic_state { |
| 79 | __u64 base_address; |
| 80 | __u32 ioregsel; |
| 81 | __u32 id; |
| 82 | __u32 irr; |
| 83 | __u32 pad; |
| 84 | union { |
| 85 | __u64 bits; |
| 86 | struct { |
| 87 | __u8 vector; |
| 88 | __u8 delivery_mode:3; |
| 89 | __u8 dest_mode:1; |
| 90 | __u8 delivery_status:1; |
| 91 | __u8 polarity:1; |
| 92 | __u8 remote_irr:1; |
| 93 | __u8 trig_mode:1; |
| 94 | __u8 mask:1; |
| 95 | __u8 reserve:7; |
| 96 | __u8 reserved[4]; |
| 97 | __u8 dest_id; |
| 98 | } fields; |
| 99 | } redirtbl[KVM_IOAPIC_NUM_PINS]; |
| 100 | }; |
| 101 | |
Avi Kivity | 8a45450 | 2007-10-10 14:03:16 +0200 | [diff] [blame] | 102 | #define KVM_IRQCHIP_PIC_MASTER 0 |
| 103 | #define KVM_IRQCHIP_PIC_SLAVE 1 |
| 104 | #define KVM_IRQCHIP_IOAPIC 2 |
He, Qing | 6ceb9d7 | 2007-07-26 11:05:18 +0300 | [diff] [blame] | 105 | |
| 106 | struct kvm_irqchip { |
| 107 | __u32 chip_id; |
| 108 | __u32 pad; |
| 109 | union { |
| 110 | char dummy[512]; /* reserving space */ |
| 111 | struct kvm_pic_state pic; |
He, Qing | 6bf9e96 | 2007-08-05 10:49:16 +0300 | [diff] [blame] | 112 | struct kvm_ioapic_state ioapic; |
He, Qing | 6ceb9d7 | 2007-07-26 11:05:18 +0300 | [diff] [blame] | 113 | } chip; |
| 114 | }; |
| 115 | |
Avi Kivity | 8a45450 | 2007-10-10 14:03:16 +0200 | [diff] [blame] | 116 | #define KVM_EXIT_UNKNOWN 0 |
| 117 | #define KVM_EXIT_EXCEPTION 1 |
| 118 | #define KVM_EXIT_IO 2 |
| 119 | #define KVM_EXIT_HYPERCALL 3 |
| 120 | #define KVM_EXIT_DEBUG 4 |
| 121 | #define KVM_EXIT_HLT 5 |
| 122 | #define KVM_EXIT_MMIO 6 |
| 123 | #define KVM_EXIT_IRQ_WINDOW_OPEN 7 |
| 124 | #define KVM_EXIT_SHUTDOWN 8 |
| 125 | #define KVM_EXIT_FAIL_ENTRY 9 |
| 126 | #define KVM_EXIT_INTR 10 |
| 127 | #define KVM_EXIT_SET_TPR 11 |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 128 | |
Avi Kivity | 9a2bb7f | 2007-02-22 12:58:31 +0200 | [diff] [blame] | 129 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 130 | struct kvm_run { |
| 131 | /* in */ |
Dor Laor | c1150d8 | 2007-01-05 16:36:24 -0800 | [diff] [blame] | 132 | __u8 request_interrupt_window; |
Avi Kivity | 02c8320 | 2007-04-29 15:02:17 +0300 | [diff] [blame] | 133 | __u8 padding1[7]; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 134 | |
| 135 | /* out */ |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 136 | __u32 exit_reason; |
Dor Laor | c1150d8 | 2007-01-05 16:36:24 -0800 | [diff] [blame] | 137 | __u8 ready_for_interrupt_injection; |
| 138 | __u8 if_flag; |
Avi Kivity | 2ff81f7 | 2007-04-29 16:25:49 +0300 | [diff] [blame] | 139 | __u8 padding2[2]; |
Dor Laor | 5481034 | 2007-02-12 00:54:39 -0800 | [diff] [blame] | 140 | |
| 141 | /* in (pre_kvm_run), out (post_kvm_run) */ |
Dor Laor | c1150d8 | 2007-01-05 16:36:24 -0800 | [diff] [blame] | 142 | __u64 cr8; |
| 143 | __u64 apic_base; |
| 144 | |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 145 | union { |
| 146 | /* KVM_EXIT_UNKNOWN */ |
| 147 | struct { |
Avi Kivity | 8eb7d33 | 2007-03-04 14:17:08 +0200 | [diff] [blame] | 148 | __u64 hardware_exit_reason; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 149 | } hw; |
Avi Kivity | 8eb7d33 | 2007-03-04 14:17:08 +0200 | [diff] [blame] | 150 | /* KVM_EXIT_FAIL_ENTRY */ |
| 151 | struct { |
| 152 | __u64 hardware_entry_failure_reason; |
| 153 | } fail_entry; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 154 | /* KVM_EXIT_EXCEPTION */ |
| 155 | struct { |
| 156 | __u32 exception; |
| 157 | __u32 error_code; |
| 158 | } ex; |
| 159 | /* KVM_EXIT_IO */ |
Avi Kivity | 46fc147 | 2007-02-22 19:39:30 +0200 | [diff] [blame] | 160 | struct kvm_io { |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 161 | #define KVM_EXIT_IO_IN 0 |
| 162 | #define KVM_EXIT_IO_OUT 1 |
| 163 | __u8 direction; |
| 164 | __u8 size; /* bytes */ |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 165 | __u16 port; |
Avi Kivity | 039576c | 2007-03-20 12:46:50 +0200 | [diff] [blame] | 166 | __u32 count; |
| 167 | __u64 data_offset; /* relative to kvm_run start */ |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 168 | } io; |
| 169 | struct { |
| 170 | } debug; |
| 171 | /* KVM_EXIT_MMIO */ |
| 172 | struct { |
| 173 | __u64 phys_addr; |
| 174 | __u8 data[8]; |
| 175 | __u32 len; |
| 176 | __u8 is_write; |
| 177 | } mmio; |
Avi Kivity | b4e63f5 | 2007-03-04 13:59:30 +0200 | [diff] [blame] | 178 | /* KVM_EXIT_HYPERCALL */ |
| 179 | struct { |
Jeff Dike | 519ef35 | 2007-07-16 15:24:47 -0400 | [diff] [blame] | 180 | __u64 nr; |
Avi Kivity | b4e63f5 | 2007-03-04 13:59:30 +0200 | [diff] [blame] | 181 | __u64 args[6]; |
| 182 | __u64 ret; |
| 183 | __u32 longmode; |
| 184 | __u32 pad; |
| 185 | } hypercall; |
Avi Kivity | 24cbc7e | 2007-07-17 11:45:55 +0300 | [diff] [blame] | 186 | /* Fix the size of the union. */ |
| 187 | char padding[256]; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 188 | }; |
| 189 | }; |
| 190 | |
| 191 | /* for KVM_GET_REGS and KVM_SET_REGS */ |
| 192 | struct kvm_regs { |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 193 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ |
| 194 | __u64 rax, rbx, rcx, rdx; |
| 195 | __u64 rsi, rdi, rsp, rbp; |
| 196 | __u64 r8, r9, r10, r11; |
| 197 | __u64 r12, r13, r14, r15; |
| 198 | __u64 rip, rflags; |
| 199 | }; |
| 200 | |
Avi Kivity | b883673 | 2007-04-01 16:34:31 +0300 | [diff] [blame] | 201 | /* for KVM_GET_FPU and KVM_SET_FPU */ |
| 202 | struct kvm_fpu { |
| 203 | __u8 fpr[8][16]; |
| 204 | __u16 fcw; |
| 205 | __u16 fsw; |
| 206 | __u8 ftwx; /* in fxsave format */ |
| 207 | __u8 pad1; |
| 208 | __u16 last_opcode; |
| 209 | __u64 last_ip; |
| 210 | __u64 last_dp; |
| 211 | __u8 xmm[16][16]; |
| 212 | __u32 mxcsr; |
| 213 | __u32 pad2; |
| 214 | }; |
| 215 | |
Eddie Dong | 96ad2cc | 2007-09-06 12:22:56 +0300 | [diff] [blame] | 216 | /* for KVM_GET_LAPIC and KVM_SET_LAPIC */ |
| 217 | #define KVM_APIC_REG_SIZE 0x400 |
| 218 | struct kvm_lapic_state { |
| 219 | char regs[KVM_APIC_REG_SIZE]; |
| 220 | }; |
| 221 | |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 222 | struct kvm_segment { |
| 223 | __u64 base; |
| 224 | __u32 limit; |
| 225 | __u16 selector; |
| 226 | __u8 type; |
| 227 | __u8 present, dpl, db, s, l, g, avl; |
| 228 | __u8 unusable; |
| 229 | __u8 padding; |
| 230 | }; |
| 231 | |
| 232 | struct kvm_dtable { |
| 233 | __u64 base; |
| 234 | __u16 limit; |
| 235 | __u16 padding[3]; |
| 236 | }; |
| 237 | |
| 238 | /* for KVM_GET_SREGS and KVM_SET_SREGS */ |
| 239 | struct kvm_sregs { |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 240 | /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ |
| 241 | struct kvm_segment cs, ds, es, fs, gs, ss; |
| 242 | struct kvm_segment tr, ldt; |
| 243 | struct kvm_dtable gdt, idt; |
| 244 | __u64 cr0, cr2, cr3, cr4, cr8; |
| 245 | __u64 efer; |
| 246 | __u64 apic_base; |
Rusty Russell | 9eb829c | 2007-07-18 13:05:58 +1000 | [diff] [blame] | 247 | __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 248 | }; |
| 249 | |
| 250 | struct kvm_msr_entry { |
| 251 | __u32 index; |
| 252 | __u32 reserved; |
| 253 | __u64 data; |
| 254 | }; |
| 255 | |
| 256 | /* for KVM_GET_MSRS and KVM_SET_MSRS */ |
| 257 | struct kvm_msrs { |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 258 | __u32 nmsrs; /* number of msrs in entries */ |
Avi Kivity | bccf215 | 2007-02-21 18:04:26 +0200 | [diff] [blame] | 259 | __u32 pad; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 260 | |
| 261 | struct kvm_msr_entry entries[0]; |
| 262 | }; |
| 263 | |
| 264 | /* for KVM_GET_MSR_INDEX_LIST */ |
| 265 | struct kvm_msr_list { |
| 266 | __u32 nmsrs; /* number of msrs in entries */ |
| 267 | __u32 indices[0]; |
| 268 | }; |
| 269 | |
| 270 | /* for KVM_TRANSLATE */ |
| 271 | struct kvm_translation { |
| 272 | /* in */ |
| 273 | __u64 linear_address; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 274 | |
| 275 | /* out */ |
| 276 | __u64 physical_address; |
| 277 | __u8 valid; |
| 278 | __u8 writeable; |
| 279 | __u8 usermode; |
Avi Kivity | 8cd1330 | 2007-02-12 00:54:41 -0800 | [diff] [blame] | 280 | __u8 pad[5]; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 281 | }; |
| 282 | |
| 283 | /* for KVM_INTERRUPT */ |
| 284 | struct kvm_interrupt { |
| 285 | /* in */ |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 286 | __u32 irq; |
| 287 | }; |
| 288 | |
| 289 | struct kvm_breakpoint { |
| 290 | __u32 enabled; |
| 291 | __u32 padding; |
| 292 | __u64 address; |
| 293 | }; |
| 294 | |
| 295 | /* for KVM_DEBUG_GUEST */ |
| 296 | struct kvm_debug_guest { |
| 297 | /* int */ |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 298 | __u32 enabled; |
Avi Kivity | bccf215 | 2007-02-21 18:04:26 +0200 | [diff] [blame] | 299 | __u32 pad; |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 300 | struct kvm_breakpoint breakpoints[4]; |
| 301 | __u32 singlestep; |
| 302 | }; |
| 303 | |
| 304 | /* for KVM_GET_DIRTY_LOG */ |
| 305 | struct kvm_dirty_log { |
| 306 | __u32 slot; |
| 307 | __u32 padding; |
| 308 | union { |
| 309 | void __user *dirty_bitmap; /* one bit per page */ |
| 310 | __u64 padding; |
| 311 | }; |
| 312 | }; |
| 313 | |
Avi Kivity | 06465c5 | 2007-02-28 20:46:53 +0200 | [diff] [blame] | 314 | struct kvm_cpuid_entry { |
| 315 | __u32 function; |
| 316 | __u32 eax; |
| 317 | __u32 ebx; |
| 318 | __u32 ecx; |
| 319 | __u32 edx; |
| 320 | __u32 padding; |
| 321 | }; |
| 322 | |
| 323 | /* for KVM_SET_CPUID */ |
| 324 | struct kvm_cpuid { |
| 325 | __u32 nent; |
| 326 | __u32 padding; |
| 327 | struct kvm_cpuid_entry entries[0]; |
| 328 | }; |
| 329 | |
Avi Kivity | 1961d27 | 2007-03-05 19:46:05 +0200 | [diff] [blame] | 330 | /* for KVM_SET_SIGNAL_MASK */ |
| 331 | struct kvm_signal_mask { |
| 332 | __u32 len; |
| 333 | __u8 sigset[0]; |
| 334 | }; |
| 335 | |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 336 | #define KVMIO 0xAE |
| 337 | |
Avi Kivity | f17abe9 | 2007-02-21 19:28:04 +0200 | [diff] [blame] | 338 | /* |
| 339 | * ioctls for /dev/kvm fds: |
| 340 | */ |
Avi Kivity | 739872c | 2007-03-01 17:20:13 +0200 | [diff] [blame] | 341 | #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) |
| 342 | #define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ |
| 343 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) |
Avi Kivity | 5d308f4 | 2007-03-01 17:56:20 +0200 | [diff] [blame] | 344 | /* |
| 345 | * Check if a kvm extension is available. Argument is extension number, |
| 346 | * return is 1 (yes) or 0 (no, sorry). |
| 347 | */ |
| 348 | #define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03) |
Avi Kivity | 07c45a3 | 2007-03-07 13:05:38 +0200 | [diff] [blame] | 349 | /* |
| 350 | * Get size for mmap(vcpu_fd) |
| 351 | */ |
| 352 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ |
Avi Kivity | f17abe9 | 2007-02-21 19:28:04 +0200 | [diff] [blame] | 353 | |
| 354 | /* |
Eddie Dong | 85f455f | 2007-07-06 12:20:49 +0300 | [diff] [blame] | 355 | * Extension capability list. |
| 356 | */ |
| 357 | #define KVM_CAP_IRQCHIP 0 |
Eddie Dong | b6958ce | 2007-07-18 12:15:21 +0300 | [diff] [blame] | 358 | #define KVM_CAP_HLT 1 |
Izik Eidus | 82ce2c9 | 2007-10-02 18:52:55 +0200 | [diff] [blame] | 359 | #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 |
Izik Eidus | 6fc138d | 2007-10-09 19:20:39 +0200 | [diff] [blame^] | 360 | #define KVM_CAP_USER_MEMORY 3 |
Eddie Dong | 85f455f | 2007-07-06 12:20:49 +0300 | [diff] [blame] | 361 | |
| 362 | /* |
Avi Kivity | f17abe9 | 2007-02-21 19:28:04 +0200 | [diff] [blame] | 363 | * ioctls for VM fds |
| 364 | */ |
Avi Kivity | 739872c | 2007-03-01 17:20:13 +0200 | [diff] [blame] | 365 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) |
Izik Eidus | 82ce2c9 | 2007-10-02 18:52:55 +0200 | [diff] [blame] | 366 | #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) |
| 367 | #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) |
Izik Eidus | 6fc138d | 2007-10-09 19:20:39 +0200 | [diff] [blame^] | 368 | #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\ |
| 369 | struct kvm_userspace_memory_region) |
Avi Kivity | bccf215 | 2007-02-21 18:04:26 +0200 | [diff] [blame] | 370 | /* |
| 371 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns |
| 372 | * a vcpu fd. |
| 373 | */ |
Avi Kivity | 739872c | 2007-03-01 17:20:13 +0200 | [diff] [blame] | 374 | #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) |
| 375 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) |
Avi Kivity | e820754 | 2007-03-30 16:54:30 +0300 | [diff] [blame] | 376 | #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) |
Eddie Dong | 85f455f | 2007-07-06 12:20:49 +0300 | [diff] [blame] | 377 | /* Device model IOC */ |
| 378 | #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) |
Eddie Dong | 97222cc | 2007-09-12 10:58:04 +0300 | [diff] [blame] | 379 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) |
He, Qing | 6ceb9d7 | 2007-07-26 11:05:18 +0300 | [diff] [blame] | 380 | #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) |
| 381 | #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) |
Avi Kivity | bccf215 | 2007-02-21 18:04:26 +0200 | [diff] [blame] | 382 | |
| 383 | /* |
| 384 | * ioctls for vcpu fds |
| 385 | */ |
Avi Kivity | 739872c | 2007-03-01 17:20:13 +0200 | [diff] [blame] | 386 | #define KVM_RUN _IO(KVMIO, 0x80) |
| 387 | #define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs) |
| 388 | #define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs) |
| 389 | #define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs) |
| 390 | #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) |
| 391 | #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) |
| 392 | #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) |
| 393 | #define KVM_DEBUG_GUEST _IOW(KVMIO, 0x87, struct kvm_debug_guest) |
| 394 | #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) |
| 395 | #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) |
| 396 | #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) |
Avi Kivity | 1961d27 | 2007-03-05 19:46:05 +0200 | [diff] [blame] | 397 | #define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask) |
Avi Kivity | b883673 | 2007-04-01 16:34:31 +0300 | [diff] [blame] | 398 | #define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu) |
| 399 | #define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) |
Eddie Dong | 96ad2cc | 2007-09-06 12:22:56 +0300 | [diff] [blame] | 400 | #define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) |
| 401 | #define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) |
Avi Kivity | 6aa8b73 | 2006-12-10 02:21:36 -0800 | [diff] [blame] | 402 | |
| 403 | #endif |