diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/kvm.h | 50 | ||||
-rw-r--r-- | include/linux/kvm_para.h | 73 | ||||
-rw-r--r-- | include/linux/magic.h | 1 |
3 files changed, 101 insertions, 23 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index f3604593fb76..275354ffa1cb 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <asm/types.h> | 11 | #include <asm/types.h> |
12 | #include <linux/ioctl.h> | 12 | #include <linux/ioctl.h> |
13 | 13 | ||
14 | #define KVM_API_VERSION 3 | 14 | #define KVM_API_VERSION 4 |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Architectural interrupt line count, and the size of the bitmap needed | 17 | * Architectural interrupt line count, and the size of the bitmap needed |
@@ -52,11 +52,10 @@ enum kvm_exit_reason { | |||
52 | /* for KVM_RUN */ | 52 | /* for KVM_RUN */ |
53 | struct kvm_run { | 53 | struct kvm_run { |
54 | /* in */ | 54 | /* in */ |
55 | __u32 vcpu; | ||
56 | __u32 emulated; /* skip current instruction */ | 55 | __u32 emulated; /* skip current instruction */ |
57 | __u32 mmio_completed; /* mmio request completed */ | 56 | __u32 mmio_completed; /* mmio request completed */ |
58 | __u8 request_interrupt_window; | 57 | __u8 request_interrupt_window; |
59 | __u8 padding1[3]; | 58 | __u8 padding1[7]; |
60 | 59 | ||
61 | /* out */ | 60 | /* out */ |
62 | __u32 exit_type; | 61 | __u32 exit_type; |
@@ -111,10 +110,6 @@ struct kvm_run { | |||
111 | 110 | ||
112 | /* for KVM_GET_REGS and KVM_SET_REGS */ | 111 | /* for KVM_GET_REGS and KVM_SET_REGS */ |
113 | struct kvm_regs { | 112 | struct kvm_regs { |
114 | /* in */ | ||
115 | __u32 vcpu; | ||
116 | __u32 padding; | ||
117 | |||
118 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ | 113 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ |
119 | __u64 rax, rbx, rcx, rdx; | 114 | __u64 rax, rbx, rcx, rdx; |
120 | __u64 rsi, rdi, rsp, rbp; | 115 | __u64 rsi, rdi, rsp, rbp; |
@@ -141,10 +136,6 @@ struct kvm_dtable { | |||
141 | 136 | ||
142 | /* for KVM_GET_SREGS and KVM_SET_SREGS */ | 137 | /* for KVM_GET_SREGS and KVM_SET_SREGS */ |
143 | struct kvm_sregs { | 138 | struct kvm_sregs { |
144 | /* in */ | ||
145 | __u32 vcpu; | ||
146 | __u32 padding; | ||
147 | |||
148 | /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ | 139 | /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ |
149 | struct kvm_segment cs, ds, es, fs, gs, ss; | 140 | struct kvm_segment cs, ds, es, fs, gs, ss; |
150 | struct kvm_segment tr, ldt; | 141 | struct kvm_segment tr, ldt; |
@@ -163,8 +154,8 @@ struct kvm_msr_entry { | |||
163 | 154 | ||
164 | /* for KVM_GET_MSRS and KVM_SET_MSRS */ | 155 | /* for KVM_GET_MSRS and KVM_SET_MSRS */ |
165 | struct kvm_msrs { | 156 | struct kvm_msrs { |
166 | __u32 vcpu; | ||
167 | __u32 nmsrs; /* number of msrs in entries */ | 157 | __u32 nmsrs; /* number of msrs in entries */ |
158 | __u32 pad; | ||
168 | 159 | ||
169 | struct kvm_msr_entry entries[0]; | 160 | struct kvm_msr_entry entries[0]; |
170 | }; | 161 | }; |
@@ -179,8 +170,6 @@ struct kvm_msr_list { | |||
179 | struct kvm_translation { | 170 | struct kvm_translation { |
180 | /* in */ | 171 | /* in */ |
181 | __u64 linear_address; | 172 | __u64 linear_address; |
182 | __u32 vcpu; | ||
183 | __u32 padding; | ||
184 | 173 | ||
185 | /* out */ | 174 | /* out */ |
186 | __u64 physical_address; | 175 | __u64 physical_address; |
@@ -193,7 +182,6 @@ struct kvm_translation { | |||
193 | /* for KVM_INTERRUPT */ | 182 | /* for KVM_INTERRUPT */ |
194 | struct kvm_interrupt { | 183 | struct kvm_interrupt { |
195 | /* in */ | 184 | /* in */ |
196 | __u32 vcpu; | ||
197 | __u32 irq; | 185 | __u32 irq; |
198 | }; | 186 | }; |
199 | 187 | ||
@@ -206,8 +194,8 @@ struct kvm_breakpoint { | |||
206 | /* for KVM_DEBUG_GUEST */ | 194 | /* for KVM_DEBUG_GUEST */ |
207 | struct kvm_debug_guest { | 195 | struct kvm_debug_guest { |
208 | /* int */ | 196 | /* int */ |
209 | __u32 vcpu; | ||
210 | __u32 enabled; | 197 | __u32 enabled; |
198 | __u32 pad; | ||
211 | struct kvm_breakpoint breakpoints[4]; | 199 | struct kvm_breakpoint breakpoints[4]; |
212 | __u32 singlestep; | 200 | __u32 singlestep; |
213 | }; | 201 | }; |
@@ -224,20 +212,36 @@ struct kvm_dirty_log { | |||
224 | 212 | ||
225 | #define KVMIO 0xAE | 213 | #define KVMIO 0xAE |
226 | 214 | ||
215 | /* | ||
216 | * ioctls for /dev/kvm fds: | ||
217 | */ | ||
227 | #define KVM_GET_API_VERSION _IO(KVMIO, 1) | 218 | #define KVM_GET_API_VERSION _IO(KVMIO, 1) |
219 | #define KVM_CREATE_VM _IO(KVMIO, 2) /* returns a VM fd */ | ||
220 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 15, struct kvm_msr_list) | ||
221 | |||
222 | /* | ||
223 | * ioctls for VM fds | ||
224 | */ | ||
225 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 10, struct kvm_memory_region) | ||
226 | /* | ||
227 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns | ||
228 | * a vcpu fd. | ||
229 | */ | ||
230 | #define KVM_CREATE_VCPU _IOW(KVMIO, 11, int) | ||
231 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 12, struct kvm_dirty_log) | ||
232 | |||
233 | /* | ||
234 | * ioctls for vcpu fds | ||
235 | */ | ||
228 | #define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run) | 236 | #define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run) |
229 | #define KVM_GET_REGS _IOWR(KVMIO, 3, struct kvm_regs) | 237 | #define KVM_GET_REGS _IOR(KVMIO, 3, struct kvm_regs) |
230 | #define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs) | 238 | #define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs) |
231 | #define KVM_GET_SREGS _IOWR(KVMIO, 5, struct kvm_sregs) | 239 | #define KVM_GET_SREGS _IOR(KVMIO, 5, struct kvm_sregs) |
232 | #define KVM_SET_SREGS _IOW(KVMIO, 6, struct kvm_sregs) | 240 | #define KVM_SET_SREGS _IOW(KVMIO, 6, struct kvm_sregs) |
233 | #define KVM_TRANSLATE _IOWR(KVMIO, 7, struct kvm_translation) | 241 | #define KVM_TRANSLATE _IOWR(KVMIO, 7, struct kvm_translation) |
234 | #define KVM_INTERRUPT _IOW(KVMIO, 8, struct kvm_interrupt) | 242 | #define KVM_INTERRUPT _IOW(KVMIO, 8, struct kvm_interrupt) |
235 | #define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest) | 243 | #define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest) |
236 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 10, struct kvm_memory_region) | ||
237 | #define KVM_CREATE_VCPU _IOW(KVMIO, 11, int /* vcpu_slot */) | ||
238 | #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 12, struct kvm_dirty_log) | ||
239 | #define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs) | 244 | #define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs) |
240 | #define KVM_SET_MSRS _IOWR(KVMIO, 14, struct kvm_msrs) | 245 | #define KVM_SET_MSRS _IOW(KVMIO, 14, struct kvm_msrs) |
241 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 15, struct kvm_msr_list) | ||
242 | 246 | ||
243 | #endif | 247 | #endif |
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h new file mode 100644 index 000000000000..3b292565a693 --- /dev/null +++ b/include/linux/kvm_para.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #ifndef __LINUX_KVM_PARA_H | ||
2 | #define __LINUX_KVM_PARA_H | ||
3 | |||
4 | /* | ||
5 | * Guest OS interface for KVM paravirtualization | ||
6 | * | ||
7 | * Note: this interface is totally experimental, and is certain to change | ||
8 | * as we make progress. | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * Per-VCPU descriptor area shared between guest and host. Writable to | ||
13 | * both guest and host. Registered with the host by the guest when | ||
14 | * a guest acknowledges paravirtual mode. | ||
15 | * | ||
16 | * NOTE: all addresses are guest-physical addresses (gpa), to make it | ||
17 | * easier for the hypervisor to map between the various addresses. | ||
18 | */ | ||
19 | struct kvm_vcpu_para_state { | ||
20 | /* | ||
21 | * API version information for compatibility. If there's any support | ||
22 | * mismatch (too old host trying to execute too new guest) then | ||
23 | * the host will deny entry into paravirtual mode. Any other | ||
24 | * combination (new host + old guest and new host + new guest) | ||
25 | * is supposed to work - new host versions will support all old | ||
26 | * guest API versions. | ||
27 | */ | ||
28 | u32 guest_version; | ||
29 | u32 host_version; | ||
30 | u32 size; | ||
31 | u32 ret; | ||
32 | |||
33 | /* | ||
34 | * The address of the vm exit instruction (VMCALL or VMMCALL), | ||
35 | * which the host will patch according to the CPU model the | ||
36 | * VM runs on: | ||
37 | */ | ||
38 | u64 hypercall_gpa; | ||
39 | |||
40 | } __attribute__ ((aligned(PAGE_SIZE))); | ||
41 | |||
42 | #define KVM_PARA_API_VERSION 1 | ||
43 | |||
44 | /* | ||
45 | * This is used for an RDMSR's ECX parameter to probe for a KVM host. | ||
46 | * Hopefully no CPU vendor will use up this number. This is placed well | ||
47 | * out of way of the typical space occupied by CPU vendors' MSR indices, | ||
48 | * and we think (or at least hope) it wont be occupied in the future | ||
49 | * either. | ||
50 | */ | ||
51 | #define MSR_KVM_API_MAGIC 0x87655678 | ||
52 | |||
53 | #define KVM_EINVAL 1 | ||
54 | |||
55 | /* | ||
56 | * Hypercall calling convention: | ||
57 | * | ||
58 | * Each hypercall may have 0-6 parameters. | ||
59 | * | ||
60 | * 64-bit hypercall index is in RAX, goes from 0 to __NR_hypercalls-1 | ||
61 | * | ||
62 | * 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention | ||
63 | * order: RDI, RSI, RDX, RCX, R8, R9. | ||
64 | * | ||
65 | * 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP. | ||
66 | * (the first 3 are according to the gcc regparm calling convention) | ||
67 | * | ||
68 | * No registers are clobbered by the hypercall, except that the | ||
69 | * return value is in RAX. | ||
70 | */ | ||
71 | #define __NR_hypercalls 0 | ||
72 | |||
73 | #endif | ||
diff --git a/include/linux/magic.h b/include/linux/magic.h index b32c8a97fcec..a9c6567fe70c 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define HPFS_SUPER_MAGIC 0xf995e849 | 13 | #define HPFS_SUPER_MAGIC 0xf995e849 |
14 | #define ISOFS_SUPER_MAGIC 0x9660 | 14 | #define ISOFS_SUPER_MAGIC 0x9660 |
15 | #define JFFS2_SUPER_MAGIC 0x72b6 | 15 | #define JFFS2_SUPER_MAGIC 0x72b6 |
16 | #define KVMFS_SUPER_MAGIC 0x19700426 | ||
16 | 17 | ||
17 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ | 18 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ |
18 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ | 19 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ |