diff options
author | Sheng Yang <sheng@linux.intel.com> | 2008-10-15 08:15:06 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-10-28 08:21:34 -0400 |
commit | 5550af4df179e52753d3a43a788a113ad8cd95cd (patch) | |
tree | f19274a4f7e345e70e7da713f44c1dcccdb134e8 /include | |
parent | 6ad9f15c94822c3f067a7d443f3b414e08b34460 (diff) |
KVM: Fix guest shared interrupt with in-kernel irqchip
Every call of kvm_set_irq() should offer an irq_source_id, which is
allocated by kvm_request_irq_source_id(). Based on irq_source_id, we
identify the irq source and implement logical OR for shared level
interrupts.
The allocated irq_source_id can be freed by kvm_free_irq_source_id().
Currently, we support at most sizeof(unsigned long) different irq sources.
[Amit: - rebase to kvm.git HEAD
- move definition of KVM_USERSPACE_IRQ_SOURCE_ID to common file
- move kvm_request_irq_source_id to the update_irq ioctl]
[Xiantao: - Add kvm/ia64 stuff and make it work for kvm/ia64 guests]
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm_host.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 3833c48fae3..bb92be2153b 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -37,6 +37,8 @@ | |||
37 | #define KVM_REQ_UNHALT 6 | 37 | #define KVM_REQ_UNHALT 6 |
38 | #define KVM_REQ_MMU_SYNC 7 | 38 | #define KVM_REQ_MMU_SYNC 7 |
39 | 39 | ||
40 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | ||
41 | |||
40 | struct kvm_vcpu; | 42 | struct kvm_vcpu; |
41 | extern struct kmem_cache *kvm_vcpu_cache; | 43 | extern struct kmem_cache *kvm_vcpu_cache; |
42 | 44 | ||
@@ -306,15 +308,18 @@ struct kvm_assigned_dev_kernel { | |||
306 | int host_irq; | 308 | int host_irq; |
307 | int guest_irq; | 309 | int guest_irq; |
308 | int irq_requested; | 310 | int irq_requested; |
311 | int irq_source_id; | ||
309 | struct pci_dev *dev; | 312 | struct pci_dev *dev; |
310 | struct kvm *kvm; | 313 | struct kvm *kvm; |
311 | }; | 314 | }; |
312 | void kvm_set_irq(struct kvm *kvm, int irq, int level); | 315 | void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); |
313 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); | 316 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); |
314 | void kvm_register_irq_ack_notifier(struct kvm *kvm, | 317 | void kvm_register_irq_ack_notifier(struct kvm *kvm, |
315 | struct kvm_irq_ack_notifier *kian); | 318 | struct kvm_irq_ack_notifier *kian); |
316 | void kvm_unregister_irq_ack_notifier(struct kvm *kvm, | 319 | void kvm_unregister_irq_ack_notifier(struct kvm *kvm, |
317 | struct kvm_irq_ack_notifier *kian); | 320 | struct kvm_irq_ack_notifier *kian); |
321 | int kvm_request_irq_source_id(struct kvm *kvm); | ||
322 | void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | ||
318 | 323 | ||
319 | #ifdef CONFIG_DMAR | 324 | #ifdef CONFIG_DMAR |
320 | int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, | 325 | int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, |