diff options
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 7bde42470e37..309774715897 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -303,10 +303,10 @@ struct kvm_kernel_irq_routing_entry { | |||
303 | struct hlist_node link; | 303 | struct hlist_node link; |
304 | }; | 304 | }; |
305 | 305 | ||
306 | #ifdef __KVM_HAVE_IOAPIC | 306 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING |
307 | 307 | ||
308 | struct kvm_irq_routing_table { | 308 | struct kvm_irq_routing_table { |
309 | int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS]; | 309 | int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS]; |
310 | struct kvm_kernel_irq_routing_entry *rt_entries; | 310 | struct kvm_kernel_irq_routing_entry *rt_entries; |
311 | u32 nr_rt_entries; | 311 | u32 nr_rt_entries; |
312 | /* | 312 | /* |
@@ -392,6 +392,7 @@ struct kvm { | |||
392 | long mmu_notifier_count; | 392 | long mmu_notifier_count; |
393 | #endif | 393 | #endif |
394 | long tlbs_dirty; | 394 | long tlbs_dirty; |
395 | struct list_head devices; | ||
395 | }; | 396 | }; |
396 | 397 | ||
397 | #define kvm_err(fmt, ...) \ | 398 | #define kvm_err(fmt, ...) \ |
@@ -431,7 +432,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); | |||
431 | int __must_check vcpu_load(struct kvm_vcpu *vcpu); | 432 | int __must_check vcpu_load(struct kvm_vcpu *vcpu); |
432 | void vcpu_put(struct kvm_vcpu *vcpu); | 433 | void vcpu_put(struct kvm_vcpu *vcpu); |
433 | 434 | ||
434 | #ifdef __KVM_HAVE_IOAPIC | 435 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING |
435 | int kvm_irqfd_init(void); | 436 | int kvm_irqfd_init(void); |
436 | void kvm_irqfd_exit(void); | 437 | void kvm_irqfd_exit(void); |
437 | #else | 438 | #else |
@@ -718,11 +719,6 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, | |||
718 | void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, | 719 | void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, |
719 | bool mask); | 720 | bool mask); |
720 | 721 | ||
721 | #ifdef __KVM_HAVE_IOAPIC | ||
722 | void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, | ||
723 | union kvm_ioapic_redirect_entry *entry, | ||
724 | unsigned long *deliver_bitmask); | ||
725 | #endif | ||
726 | int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, | 722 | int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, |
727 | bool line_status); | 723 | bool line_status); |
728 | int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); | 724 | int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); |
@@ -956,7 +952,7 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq) | |||
956 | } | 952 | } |
957 | #endif | 953 | #endif |
958 | 954 | ||
959 | #ifdef KVM_CAP_IRQ_ROUTING | 955 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING |
960 | 956 | ||
961 | #define KVM_MAX_IRQ_ROUTES 1024 | 957 | #define KVM_MAX_IRQ_ROUTES 1024 |
962 | 958 | ||
@@ -965,6 +961,9 @@ int kvm_set_irq_routing(struct kvm *kvm, | |||
965 | const struct kvm_irq_routing_entry *entries, | 961 | const struct kvm_irq_routing_entry *entries, |
966 | unsigned nr, | 962 | unsigned nr, |
967 | unsigned flags); | 963 | unsigned flags); |
964 | int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, | ||
965 | struct kvm_kernel_irq_routing_entry *e, | ||
966 | const struct kvm_irq_routing_entry *ue); | ||
968 | void kvm_free_irq_routing(struct kvm *kvm); | 967 | void kvm_free_irq_routing(struct kvm *kvm); |
969 | 968 | ||
970 | int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi); | 969 | int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi); |
@@ -1065,6 +1064,43 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) | |||
1065 | 1064 | ||
1066 | extern bool kvm_rebooting; | 1065 | extern bool kvm_rebooting; |
1067 | 1066 | ||
1067 | struct kvm_device_ops; | ||
1068 | |||
1069 | struct kvm_device { | ||
1070 | struct kvm_device_ops *ops; | ||
1071 | struct kvm *kvm; | ||
1072 | void *private; | ||
1073 | struct list_head vm_node; | ||
1074 | }; | ||
1075 | |||
1076 | /* create, destroy, and name are mandatory */ | ||
1077 | struct kvm_device_ops { | ||
1078 | const char *name; | ||
1079 | int (*create)(struct kvm_device *dev, u32 type); | ||
1080 | |||
1081 | /* | ||
1082 | * Destroy is responsible for freeing dev. | ||
1083 | * | ||
1084 | * Destroy may be called before or after destructors are called | ||
1085 | * on emulated I/O regions, depending on whether a reference is | ||
1086 | * held by a vcpu or other kvm component that gets destroyed | ||
1087 | * after the emulated I/O. | ||
1088 | */ | ||
1089 | void (*destroy)(struct kvm_device *dev); | ||
1090 | |||
1091 | int (*set_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); | ||
1092 | int (*get_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); | ||
1093 | int (*has_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); | ||
1094 | long (*ioctl)(struct kvm_device *dev, unsigned int ioctl, | ||
1095 | unsigned long arg); | ||
1096 | }; | ||
1097 | |||
1098 | void kvm_device_get(struct kvm_device *dev); | ||
1099 | void kvm_device_put(struct kvm_device *dev); | ||
1100 | struct kvm_device *kvm_device_from_filp(struct file *filp); | ||
1101 | |||
1102 | extern struct kvm_device_ops kvm_mpic_ops; | ||
1103 | |||
1068 | #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT | 1104 | #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT |
1069 | 1105 | ||
1070 | static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val) | 1106 | static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val) |