diff options
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 62 |
1 files changed, 55 insertions, 7 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index bf6f703642fc..894a56e365e8 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #define KVM_REQ_PENDING_TIMER 5 | 37 | #define KVM_REQ_PENDING_TIMER 5 |
38 | #define KVM_REQ_UNHALT 6 | 38 | #define KVM_REQ_UNHALT 6 |
39 | #define KVM_REQ_MMU_SYNC 7 | 39 | #define KVM_REQ_MMU_SYNC 7 |
40 | #define KVM_REQ_KVMCLOCK_UPDATE 8 | ||
40 | 41 | ||
41 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | 42 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 |
42 | 43 | ||
@@ -73,7 +74,7 @@ struct kvm_vcpu { | |||
73 | struct kvm_run *run; | 74 | struct kvm_run *run; |
74 | int guest_mode; | 75 | int guest_mode; |
75 | unsigned long requests; | 76 | unsigned long requests; |
76 | struct kvm_guest_debug guest_debug; | 77 | unsigned long guest_debug; |
77 | int fpu_active; | 78 | int fpu_active; |
78 | int guest_fpu_loaded; | 79 | int guest_fpu_loaded; |
79 | wait_queue_head_t wq; | 80 | wait_queue_head_t wq; |
@@ -107,6 +108,20 @@ struct kvm_memory_slot { | |||
107 | int user_alloc; | 108 | int user_alloc; |
108 | }; | 109 | }; |
109 | 110 | ||
111 | struct kvm_kernel_irq_routing_entry { | ||
112 | u32 gsi; | ||
113 | int (*set)(struct kvm_kernel_irq_routing_entry *e, | ||
114 | struct kvm *kvm, int level); | ||
115 | union { | ||
116 | struct { | ||
117 | unsigned irqchip; | ||
118 | unsigned pin; | ||
119 | } irqchip; | ||
120 | struct msi_msg msi; | ||
121 | }; | ||
122 | struct list_head link; | ||
123 | }; | ||
124 | |||
110 | struct kvm { | 125 | struct kvm { |
111 | struct mutex lock; /* protects the vcpus array and APIC accesses */ | 126 | struct mutex lock; /* protects the vcpus array and APIC accesses */ |
112 | spinlock_t mmu_lock; | 127 | spinlock_t mmu_lock; |
@@ -127,6 +142,11 @@ struct kvm { | |||
127 | struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; | 142 | struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; |
128 | #endif | 143 | #endif |
129 | 144 | ||
145 | #ifdef CONFIG_HAVE_KVM_IRQCHIP | ||
146 | struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */ | ||
147 | struct hlist_head mask_notifier_list; | ||
148 | #endif | ||
149 | |||
130 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER | 150 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER |
131 | struct mmu_notifier mmu_notifier; | 151 | struct mmu_notifier mmu_notifier; |
132 | unsigned long mmu_notifier_seq; | 152 | unsigned long mmu_notifier_seq; |
@@ -237,7 +257,6 @@ int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, | |||
237 | int user_alloc); | 257 | int user_alloc); |
238 | long kvm_arch_vm_ioctl(struct file *filp, | 258 | long kvm_arch_vm_ioctl(struct file *filp, |
239 | unsigned int ioctl, unsigned long arg); | 259 | unsigned int ioctl, unsigned long arg); |
240 | void kvm_arch_destroy_vm(struct kvm *kvm); | ||
241 | 260 | ||
242 | int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); | 261 | int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); |
243 | int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); | 262 | int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); |
@@ -255,8 +274,8 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, | |||
255 | struct kvm_mp_state *mp_state); | 274 | struct kvm_mp_state *mp_state); |
256 | int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, | 275 | int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, |
257 | struct kvm_mp_state *mp_state); | 276 | struct kvm_mp_state *mp_state); |
258 | int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, | 277 | int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, |
259 | struct kvm_debug_guest *dbg); | 278 | struct kvm_guest_debug *dbg); |
260 | int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); | 279 | int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); |
261 | 280 | ||
262 | int kvm_arch_init(void *opaque); | 281 | int kvm_arch_init(void *opaque); |
@@ -310,7 +329,6 @@ struct kvm_assigned_dev_kernel { | |||
310 | int host_irq; | 329 | int host_irq; |
311 | bool host_irq_disabled; | 330 | bool host_irq_disabled; |
312 | int guest_irq; | 331 | int guest_irq; |
313 | struct msi_msg guest_msi; | ||
314 | #define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0) | 332 | #define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0) |
315 | #define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1) | 333 | #define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1) |
316 | #define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8) | 334 | #define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8) |
@@ -321,8 +339,21 @@ struct kvm_assigned_dev_kernel { | |||
321 | struct pci_dev *dev; | 339 | struct pci_dev *dev; |
322 | struct kvm *kvm; | 340 | struct kvm *kvm; |
323 | }; | 341 | }; |
324 | void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); | 342 | |
325 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); | 343 | struct kvm_irq_mask_notifier { |
344 | void (*func)(struct kvm_irq_mask_notifier *kimn, bool masked); | ||
345 | int irq; | ||
346 | struct hlist_node link; | ||
347 | }; | ||
348 | |||
349 | void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq, | ||
350 | struct kvm_irq_mask_notifier *kimn); | ||
351 | void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, | ||
352 | struct kvm_irq_mask_notifier *kimn); | ||
353 | void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask); | ||
354 | |||
355 | int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); | ||
356 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); | ||
326 | void kvm_register_irq_ack_notifier(struct kvm *kvm, | 357 | void kvm_register_irq_ack_notifier(struct kvm *kvm, |
327 | struct kvm_irq_ack_notifier *kian); | 358 | struct kvm_irq_ack_notifier *kian); |
328 | void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian); | 359 | void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian); |
@@ -464,4 +495,21 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se | |||
464 | } | 495 | } |
465 | #endif | 496 | #endif |
466 | 497 | ||
498 | #ifdef CONFIG_HAVE_KVM_IRQCHIP | ||
499 | |||
500 | #define KVM_MAX_IRQ_ROUTES 1024 | ||
501 | |||
502 | int kvm_setup_default_irq_routing(struct kvm *kvm); | ||
503 | int kvm_set_irq_routing(struct kvm *kvm, | ||
504 | const struct kvm_irq_routing_entry *entries, | ||
505 | unsigned nr, | ||
506 | unsigned flags); | ||
507 | void kvm_free_irq_routing(struct kvm *kvm); | ||
508 | |||
509 | #else | ||
510 | |||
511 | static inline void kvm_free_irq_routing(struct kvm *kvm) {} | ||
512 | |||
513 | #endif | ||
514 | |||
467 | #endif | 515 | #endif |