diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-27 13:13:52 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-27 13:13:52 -0400 |
| commit | 42cadc86008aae0fd9ff31642dc01ed50723cf32 (patch) | |
| tree | b05d4c8f0561bad5a0183a89fb23ce4c8ee1653c /include/linux | |
| parent | fba5c1af5c4fd6645fe62ea84ccde0981282cf66 (diff) | |
| parent | 66c0b394f08fd89236515c1c84485ea712a157be (diff) | |
Merge branch 'kvm-updates-2.6.26' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm
* 'kvm-updates-2.6.26' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm: (147 commits)
KVM: kill file->f_count abuse in kvm
KVM: MMU: kvm_pv_mmu_op should not take mmap_sem
KVM: SVM: remove selective CR0 comment
KVM: SVM: remove now obsolete FIXME comment
KVM: SVM: disable CR8 intercept when tpr is not masking interrupts
KVM: SVM: sync V_TPR with LAPIC.TPR if CR8 write intercept is disabled
KVM: export kvm_lapic_set_tpr() to modules
KVM: SVM: sync TPR value to V_TPR field in the VMCB
KVM: ppc: PowerPC 440 KVM implementation
KVM: Add MAINTAINERS entry for PowerPC KVM
KVM: ppc: Add DCR access information to struct kvm_run
ppc: Export tlb_44x_hwater for KVM
KVM: Rename debugfs_dir to kvm_debugfs_dir
KVM: x86 emulator: fix lea to really get the effective address
KVM: x86 emulator: fix smsw and lmsw with a memory operand
KVM: x86 emulator: initialize src.val and dst.val for register operands
KVM: SVM: force a new asid when initializing the vmcb
KVM: fix kvm_vcpu_kick vs __vcpu_run race
KVM: add ioctls to save/store mpstate
KVM: Rename VCPU_MP_STATE_* to KVM_MP_STATE_*
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kvm.h | 130 | ||||
| -rw-r--r-- | include/linux/kvm_host.h | 59 | ||||
| -rw-r--r-- | include/linux/kvm_para.h | 11 | ||||
| -rw-r--r-- | include/linux/kvm_types.h | 2 | ||||
| -rw-r--r-- | include/linux/sched.h | 2 |
5 files changed, 188 insertions, 16 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 */ | ||
| 18 | struct 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 */ |
| 17 | struct kvm_memory_region { | 24 | struct 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) */ |
| 78 | struct kvm_run { | 88 | struct 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 | |||
| 246 | struct kvm_mp_state { | ||
| 247 | __u32 mp_state; | ||
| 248 | }; | ||
| 249 | |||
| 250 | struct 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 | |||
| 264 | struct 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. */ | ||
| 289 | struct 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 |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 928b0d59e9ba..398978972b7a 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
| 16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
| 17 | #include <linux/preempt.h> | 17 | #include <linux/preempt.h> |
| 18 | #include <linux/marker.h> | ||
| 18 | #include <asm/signal.h> | 19 | #include <asm/signal.h> |
| 19 | 20 | ||
| 20 | #include <linux/kvm.h> | 21 | #include <linux/kvm.h> |
| @@ -24,29 +25,18 @@ | |||
| 24 | 25 | ||
| 25 | #include <asm/kvm_host.h> | 26 | #include <asm/kvm_host.h> |
| 26 | 27 | ||
| 27 | #define KVM_MAX_VCPUS 4 | ||
| 28 | #define KVM_MEMORY_SLOTS 8 | ||
| 29 | /* memory slots that does not exposed to userspace */ | ||
| 30 | #define KVM_PRIVATE_MEM_SLOTS 4 | ||
| 31 | |||
| 32 | #define KVM_PIO_PAGE_OFFSET 1 | ||
| 33 | |||
| 34 | /* | 28 | /* |
| 35 | * vcpu->requests bit members | 29 | * vcpu->requests bit members |
| 36 | */ | 30 | */ |
| 37 | #define KVM_REQ_TLB_FLUSH 0 | 31 | #define KVM_REQ_TLB_FLUSH 0 |
| 38 | #define KVM_REQ_MIGRATE_TIMER 1 | 32 | #define KVM_REQ_MIGRATE_TIMER 1 |
| 39 | #define KVM_REQ_REPORT_TPR_ACCESS 2 | 33 | #define KVM_REQ_REPORT_TPR_ACCESS 2 |
| 34 | #define KVM_REQ_MMU_RELOAD 3 | ||
| 35 | #define KVM_REQ_TRIPLE_FAULT 4 | ||
| 40 | 36 | ||
| 41 | struct kvm_vcpu; | 37 | struct kvm_vcpu; |
| 42 | extern struct kmem_cache *kvm_vcpu_cache; | 38 | extern struct kmem_cache *kvm_vcpu_cache; |
| 43 | 39 | ||
| 44 | struct kvm_guest_debug { | ||
| 45 | int enabled; | ||
| 46 | unsigned long bp[4]; | ||
| 47 | int singlestep; | ||
| 48 | }; | ||
| 49 | |||
| 50 | /* | 40 | /* |
| 51 | * It would be nice to use something smarter than a linear search, TBD... | 41 | * It would be nice to use something smarter than a linear search, TBD... |
| 52 | * Thankfully we dont expect many devices to register (famous last words :), | 42 | * Thankfully we dont expect many devices to register (famous last words :), |
| @@ -67,7 +57,9 @@ void kvm_io_bus_register_dev(struct kvm_io_bus *bus, | |||
| 67 | 57 | ||
| 68 | struct kvm_vcpu { | 58 | struct kvm_vcpu { |
| 69 | struct kvm *kvm; | 59 | struct kvm *kvm; |
| 60 | #ifdef CONFIG_PREEMPT_NOTIFIERS | ||
| 70 | struct preempt_notifier preempt_notifier; | 61 | struct preempt_notifier preempt_notifier; |
| 62 | #endif | ||
| 71 | int vcpu_id; | 63 | int vcpu_id; |
| 72 | struct mutex mutex; | 64 | struct mutex mutex; |
| 73 | int cpu; | 65 | int cpu; |
| @@ -100,6 +92,10 @@ struct kvm_memory_slot { | |||
| 100 | unsigned long flags; | 92 | unsigned long flags; |
| 101 | unsigned long *rmap; | 93 | unsigned long *rmap; |
| 102 | unsigned long *dirty_bitmap; | 94 | unsigned long *dirty_bitmap; |
| 95 | struct { | ||
| 96 | unsigned long rmap_pde; | ||
| 97 | int write_count; | ||
| 98 | } *lpage_info; | ||
| 103 | unsigned long userspace_addr; | 99 | unsigned long userspace_addr; |
| 104 | int user_alloc; | 100 | int user_alloc; |
| 105 | }; | 101 | }; |
| @@ -114,11 +110,11 @@ struct kvm { | |||
| 114 | KVM_PRIVATE_MEM_SLOTS]; | 110 | KVM_PRIVATE_MEM_SLOTS]; |
| 115 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; | 111 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; |
| 116 | struct list_head vm_list; | 112 | struct list_head vm_list; |
| 117 | struct file *filp; | ||
| 118 | struct kvm_io_bus mmio_bus; | 113 | struct kvm_io_bus mmio_bus; |
| 119 | struct kvm_io_bus pio_bus; | 114 | struct kvm_io_bus pio_bus; |
| 120 | struct kvm_vm_stat stat; | 115 | struct kvm_vm_stat stat; |
| 121 | struct kvm_arch arch; | 116 | struct kvm_arch arch; |
| 117 | atomic_t users_count; | ||
| 122 | }; | 118 | }; |
| 123 | 119 | ||
| 124 | /* The guest did something we don't support. */ | 120 | /* The guest did something we don't support. */ |
| @@ -145,14 +141,19 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
| 145 | struct module *module); | 141 | struct module *module); |
| 146 | void kvm_exit(void); | 142 | void kvm_exit(void); |
| 147 | 143 | ||
| 144 | void kvm_get_kvm(struct kvm *kvm); | ||
| 145 | void kvm_put_kvm(struct kvm *kvm); | ||
| 146 | |||
| 148 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) | 147 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) |
| 149 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) | 148 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) |
| 150 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } | 149 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } |
| 151 | struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva); | 150 | struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva); |
| 152 | 151 | ||
| 153 | extern struct page *bad_page; | 152 | extern struct page *bad_page; |
| 153 | extern pfn_t bad_pfn; | ||
| 154 | 154 | ||
| 155 | int is_error_page(struct page *page); | 155 | int is_error_page(struct page *page); |
| 156 | int is_error_pfn(pfn_t pfn); | ||
| 156 | int kvm_is_error_hva(unsigned long addr); | 157 | int kvm_is_error_hva(unsigned long addr); |
| 157 | int kvm_set_memory_region(struct kvm *kvm, | 158 | int kvm_set_memory_region(struct kvm *kvm, |
| 158 | struct kvm_userspace_memory_region *mem, | 159 | struct kvm_userspace_memory_region *mem, |
| @@ -166,8 +167,19 @@ int kvm_arch_set_memory_region(struct kvm *kvm, | |||
| 166 | int user_alloc); | 167 | int user_alloc); |
| 167 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); | 168 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); |
| 168 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); | 169 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); |
| 170 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); | ||
| 169 | void kvm_release_page_clean(struct page *page); | 171 | void kvm_release_page_clean(struct page *page); |
| 170 | void kvm_release_page_dirty(struct page *page); | 172 | void kvm_release_page_dirty(struct page *page); |
| 173 | void kvm_set_page_dirty(struct page *page); | ||
| 174 | void kvm_set_page_accessed(struct page *page); | ||
| 175 | |||
| 176 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); | ||
| 177 | void kvm_release_pfn_dirty(pfn_t); | ||
| 178 | void kvm_release_pfn_clean(pfn_t pfn); | ||
| 179 | void kvm_set_pfn_dirty(pfn_t pfn); | ||
| 180 | void kvm_set_pfn_accessed(pfn_t pfn); | ||
| 181 | void kvm_get_pfn(pfn_t pfn); | ||
| 182 | |||
| 171 | int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset, | 183 | int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset, |
| 172 | int len); | 184 | int len); |
| 173 | int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data, | 185 | int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data, |
| @@ -188,6 +200,7 @@ void kvm_resched(struct kvm_vcpu *vcpu); | |||
| 188 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); | 200 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); |
| 189 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); | 201 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); |
| 190 | void kvm_flush_remote_tlbs(struct kvm *kvm); | 202 | void kvm_flush_remote_tlbs(struct kvm *kvm); |
| 203 | void kvm_reload_remote_mmus(struct kvm *kvm); | ||
| 191 | 204 | ||
| 192 | long kvm_arch_dev_ioctl(struct file *filp, | 205 | long kvm_arch_dev_ioctl(struct file *filp, |
| 193 | unsigned int ioctl, unsigned long arg); | 206 | unsigned int ioctl, unsigned long arg); |
| @@ -223,6 +236,10 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, | |||
| 223 | struct kvm_sregs *sregs); | 236 | struct kvm_sregs *sregs); |
| 224 | int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | 237 | int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, |
| 225 | struct kvm_sregs *sregs); | 238 | struct kvm_sregs *sregs); |
| 239 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, | ||
| 240 | struct kvm_mp_state *mp_state); | ||
| 241 | int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, | ||
| 242 | struct kvm_mp_state *mp_state); | ||
| 226 | int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, | 243 | int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, |
| 227 | struct kvm_debug_guest *dbg); | 244 | struct kvm_debug_guest *dbg); |
| 228 | int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); | 245 | int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); |
| @@ -255,6 +272,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm); | |||
| 255 | 272 | ||
| 256 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 273 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
| 257 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 274 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
| 275 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); | ||
| 258 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | 276 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); |
| 259 | 277 | ||
| 260 | static inline void kvm_guest_enter(void) | 278 | static inline void kvm_guest_enter(void) |
| @@ -296,5 +314,18 @@ struct kvm_stats_debugfs_item { | |||
| 296 | struct dentry *dentry; | 314 | struct dentry *dentry; |
| 297 | }; | 315 | }; |
| 298 | extern struct kvm_stats_debugfs_item debugfs_entries[]; | 316 | extern struct kvm_stats_debugfs_item debugfs_entries[]; |
| 317 | extern struct dentry *kvm_debugfs_dir; | ||
| 318 | |||
| 319 | #ifdef CONFIG_KVM_TRACE | ||
| 320 | int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg); | ||
| 321 | void kvm_trace_cleanup(void); | ||
| 322 | #else | ||
| 323 | static inline | ||
| 324 | int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg) | ||
| 325 | { | ||
| 326 | return -EINVAL; | ||
| 327 | } | ||
| 328 | #define kvm_trace_cleanup() ((void)0) | ||
| 329 | #endif | ||
| 299 | 330 | ||
| 300 | #endif | 331 | #endif |
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h index 5497aac0d2f8..3ddce03766ca 100644 --- a/include/linux/kvm_para.h +++ b/include/linux/kvm_para.h | |||
| @@ -11,8 +11,11 @@ | |||
| 11 | 11 | ||
| 12 | /* Return values for hypercalls */ | 12 | /* Return values for hypercalls */ |
| 13 | #define KVM_ENOSYS 1000 | 13 | #define KVM_ENOSYS 1000 |
| 14 | #define KVM_EFAULT EFAULT | ||
| 15 | #define KVM_E2BIG E2BIG | ||
| 14 | 16 | ||
| 15 | #define KVM_HC_VAPIC_POLL_IRQ 1 | 17 | #define KVM_HC_VAPIC_POLL_IRQ 1 |
| 18 | #define KVM_HC_MMU_OP 2 | ||
| 16 | 19 | ||
| 17 | /* | 20 | /* |
| 18 | * hypercalls use architecture specific | 21 | * hypercalls use architecture specific |
| @@ -20,6 +23,12 @@ | |||
| 20 | #include <asm/kvm_para.h> | 23 | #include <asm/kvm_para.h> |
| 21 | 24 | ||
| 22 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
| 26 | #ifdef CONFIG_KVM_GUEST | ||
| 27 | void __init kvm_guest_init(void); | ||
| 28 | #else | ||
| 29 | #define kvm_guest_init() do { } while (0) | ||
| 30 | #endif | ||
| 31 | |||
| 23 | static inline int kvm_para_has_feature(unsigned int feature) | 32 | static inline int kvm_para_has_feature(unsigned int feature) |
| 24 | { | 33 | { |
| 25 | if (kvm_arch_para_features() & (1UL << feature)) | 34 | if (kvm_arch_para_features() & (1UL << feature)) |
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index 1c4e46decb22..9b6f395c9625 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h | |||
| @@ -38,6 +38,8 @@ typedef unsigned long hva_t; | |||
| 38 | typedef u64 hpa_t; | 38 | typedef u64 hpa_t; |
| 39 | typedef unsigned long hfn_t; | 39 | typedef unsigned long hfn_t; |
| 40 | 40 | ||
| 41 | typedef hfn_t pfn_t; | ||
| 42 | |||
| 41 | struct kvm_pio_request { | 43 | struct kvm_pio_request { |
| 42 | unsigned long count; | 44 | unsigned long count; |
| 43 | int cur_count; | 45 | int cur_count; |
diff --git a/include/linux/sched.h b/include/linux/sched.h index d0bd97044abd..9a4f3e63e3bf 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -1798,6 +1798,8 @@ extern void mmput(struct mm_struct *); | |||
| 1798 | extern struct mm_struct *get_task_mm(struct task_struct *task); | 1798 | extern struct mm_struct *get_task_mm(struct task_struct *task); |
| 1799 | /* Remove the current tasks stale references to the old mm_struct */ | 1799 | /* Remove the current tasks stale references to the old mm_struct */ |
| 1800 | extern void mm_release(struct task_struct *, struct mm_struct *); | 1800 | extern void mm_release(struct task_struct *, struct mm_struct *); |
| 1801 | /* Allocate a new mm structure and copy contents from tsk->mm */ | ||
| 1802 | extern struct mm_struct *dup_mm(struct task_struct *tsk); | ||
| 1801 | 1803 | ||
| 1802 | extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); | 1804 | extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); |
| 1803 | extern void flush_thread(void); | 1805 | extern void flush_thread(void); |
