diff options
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 4b036430ea23..6252802c3cc0 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -286,6 +286,53 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | |||
286 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); | 286 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); |
287 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | 287 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); |
288 | 288 | ||
289 | struct kvm_irq_ack_notifier { | ||
290 | struct hlist_node link; | ||
291 | unsigned gsi; | ||
292 | void (*irq_acked)(struct kvm_irq_ack_notifier *kian); | ||
293 | }; | ||
294 | |||
295 | struct kvm_assigned_dev_kernel { | ||
296 | struct kvm_irq_ack_notifier ack_notifier; | ||
297 | struct work_struct interrupt_work; | ||
298 | struct list_head list; | ||
299 | int assigned_dev_id; | ||
300 | int host_busnr; | ||
301 | int host_devfn; | ||
302 | int host_irq; | ||
303 | int guest_irq; | ||
304 | int irq_requested; | ||
305 | struct pci_dev *dev; | ||
306 | struct kvm *kvm; | ||
307 | }; | ||
308 | |||
309 | #ifdef CONFIG_DMAR | ||
310 | int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, | ||
311 | unsigned long npages); | ||
312 | int kvm_iommu_map_guest(struct kvm *kvm, | ||
313 | struct kvm_assigned_dev_kernel *assigned_dev); | ||
314 | int kvm_iommu_unmap_guest(struct kvm *kvm); | ||
315 | #else /* CONFIG_DMAR */ | ||
316 | static inline int kvm_iommu_map_pages(struct kvm *kvm, | ||
317 | gfn_t base_gfn, | ||
318 | unsigned long npages) | ||
319 | { | ||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | static inline int kvm_iommu_map_guest(struct kvm *kvm, | ||
324 | struct kvm_assigned_dev_kernel | ||
325 | *assigned_dev) | ||
326 | { | ||
327 | return -ENODEV; | ||
328 | } | ||
329 | |||
330 | static inline int kvm_iommu_unmap_guest(struct kvm *kvm) | ||
331 | { | ||
332 | return 0; | ||
333 | } | ||
334 | #endif /* CONFIG_DMAR */ | ||
335 | |||
289 | static inline void kvm_guest_enter(void) | 336 | static inline void kvm_guest_enter(void) |
290 | { | 337 | { |
291 | account_system_vtime(current); | 338 | account_system_vtime(current); |
@@ -308,6 +355,11 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn) | |||
308 | return (gpa_t)gfn << PAGE_SHIFT; | 355 | return (gpa_t)gfn << PAGE_SHIFT; |
309 | } | 356 | } |
310 | 357 | ||
358 | static inline hpa_t pfn_to_hpa(pfn_t pfn) | ||
359 | { | ||
360 | return (hpa_t)pfn << PAGE_SHIFT; | ||
361 | } | ||
362 | |||
311 | static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) | 363 | static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) |
312 | { | 364 | { |
313 | set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); | 365 | set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); |