aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/kvm_host.h23
-rw-r--r--include/linux/kvm.h3
-rw-r--r--include/linux/kvm_host.h52
3 files changed, 58 insertions, 20 deletions
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 68a3ac13afce..805629c0f15f 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -331,26 +331,6 @@ struct kvm_mem_alias {
331 gfn_t target_gfn; 331 gfn_t target_gfn;
332}; 332};
333 333
334struct kvm_irq_ack_notifier {
335 struct hlist_node link;
336 unsigned gsi;
337 void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
338};
339
340struct kvm_assigned_dev_kernel {
341 struct kvm_irq_ack_notifier ack_notifier;
342 struct work_struct interrupt_work;
343 struct list_head list;
344 int assigned_dev_id;
345 int host_busnr;
346 int host_devfn;
347 int host_irq;
348 int guest_irq;
349 int irq_requested;
350 struct pci_dev *dev;
351 struct kvm *kvm;
352};
353
354struct kvm_arch{ 334struct kvm_arch{
355 int naliases; 335 int naliases;
356 struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS]; 336 struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS];
@@ -364,6 +344,7 @@ struct kvm_arch{
364 */ 344 */
365 struct list_head active_mmu_pages; 345 struct list_head active_mmu_pages;
366 struct list_head assigned_dev_head; 346 struct list_head assigned_dev_head;
347 struct dmar_domain *intel_iommu_domain;
367 struct kvm_pic *vpic; 348 struct kvm_pic *vpic;
368 struct kvm_ioapic *vioapic; 349 struct kvm_ioapic *vioapic;
369 struct kvm_pit *vpit; 350 struct kvm_pit *vpit;
@@ -514,6 +495,8 @@ int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
514int kvm_pv_mmu_op(struct kvm_vcpu *vcpu, unsigned long bytes, 495int kvm_pv_mmu_op(struct kvm_vcpu *vcpu, unsigned long bytes,
515 gpa_t addr, unsigned long *ret); 496 gpa_t addr, unsigned long *ret);
516 497
498int is_mmio_pfn(pfn_t pfn);
499
517extern bool tdp_enabled; 500extern bool tdp_enabled;
518 501
519enum emulation_result { 502enum emulation_result {
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index ef4bc6f89778..4269be171faf 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -384,6 +384,7 @@ struct kvm_trace_rec {
384#define KVM_CAP_COALESCED_MMIO 15 384#define KVM_CAP_COALESCED_MMIO 15
385#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ 385#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
386#define KVM_CAP_DEVICE_ASSIGNMENT 17 386#define KVM_CAP_DEVICE_ASSIGNMENT 17
387#define KVM_CAP_IOMMU 18
387 388
388/* 389/*
389 * ioctls for VM fds 390 * ioctls for VM fds
@@ -495,4 +496,6 @@ struct kvm_assigned_irq {
495 __u32 flags; 496 __u32 flags;
496}; 497};
497 498
499#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
500
498#endif 501#endif
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);
286int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 286int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
287void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 287void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
288 288
289struct kvm_irq_ack_notifier {
290 struct hlist_node link;
291 unsigned gsi;
292 void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
293};
294
295struct 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
310int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn,
311 unsigned long npages);
312int kvm_iommu_map_guest(struct kvm *kvm,
313 struct kvm_assigned_dev_kernel *assigned_dev);
314int kvm_iommu_unmap_guest(struct kvm *kvm);
315#else /* CONFIG_DMAR */
316static inline int kvm_iommu_map_pages(struct kvm *kvm,
317 gfn_t base_gfn,
318 unsigned long npages)
319{
320 return 0;
321}
322
323static inline int kvm_iommu_map_guest(struct kvm *kvm,
324 struct kvm_assigned_dev_kernel
325 *assigned_dev)
326{
327 return -ENODEV;
328}
329
330static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
331{
332 return 0;
333}
334#endif /* CONFIG_DMAR */
335
289static inline void kvm_guest_enter(void) 336static 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
358static inline hpa_t pfn_to_hpa(pfn_t pfn)
359{
360 return (hpa_t)pfn << PAGE_SHIFT;
361}
362
311static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) 363static 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);