diff options
author | Sheng Yang <sheng@linux.intel.com> | 2008-11-24 01:32:51 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:55:01 -0500 |
commit | 4f906c19ae29397409bedabf7bbe5cb42ad90332 (patch) | |
tree | bbe53d39fa8be58d714a87acf1e6f14366890092 | |
parent | 00e3ed39e2e25ffb3417ce1bec8f4b78ed4b85e7 (diff) |
KVM: Replace irq_requested with more generic irq_requested_type
Separate guest irq type and host irq type, for we can support guest using INTx
with host using MSI (but not opposite combination).
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | include/linux/kvm_host.h | 4 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 3a0fb77d1f6a..c3d4b96a08fa 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -307,7 +307,9 @@ struct kvm_assigned_dev_kernel { | |||
307 | int host_devfn; | 307 | int host_devfn; |
308 | int host_irq; | 308 | int host_irq; |
309 | int guest_irq; | 309 | int guest_irq; |
310 | int irq_requested; | 310 | #define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0) |
311 | #define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8) | ||
312 | unsigned long irq_requested_type; | ||
311 | int irq_source_id; | 313 | int irq_source_id; |
312 | struct pci_dev *dev; | 314 | struct pci_dev *dev; |
313 | struct kvm *kvm; | 315 | struct kvm *kvm; |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index ef2f03cf42c0..638de47e167d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -140,7 +140,7 @@ static void kvm_free_assigned_device(struct kvm *kvm, | |||
140 | struct kvm_assigned_dev_kernel | 140 | struct kvm_assigned_dev_kernel |
141 | *assigned_dev) | 141 | *assigned_dev) |
142 | { | 142 | { |
143 | if (irqchip_in_kernel(kvm) && assigned_dev->irq_requested) | 143 | if (irqchip_in_kernel(kvm) && assigned_dev->irq_requested_type) |
144 | free_irq(assigned_dev->host_irq, (void *)assigned_dev); | 144 | free_irq(assigned_dev->host_irq, (void *)assigned_dev); |
145 | 145 | ||
146 | kvm_unregister_irq_ack_notifier(&assigned_dev->ack_notifier); | 146 | kvm_unregister_irq_ack_notifier(&assigned_dev->ack_notifier); |
@@ -180,7 +180,7 @@ static int assigned_device_update_intx(struct kvm *kvm, | |||
180 | struct kvm_assigned_dev_kernel *adev, | 180 | struct kvm_assigned_dev_kernel *adev, |
181 | struct kvm_assigned_irq *airq) | 181 | struct kvm_assigned_irq *airq) |
182 | { | 182 | { |
183 | if (adev->irq_requested) { | 183 | if (adev->irq_requested_type & KVM_ASSIGNED_DEV_GUEST_INTX) { |
184 | adev->guest_irq = airq->guest_irq; | 184 | adev->guest_irq = airq->guest_irq; |
185 | adev->ack_notifier.gsi = airq->guest_irq; | 185 | adev->ack_notifier.gsi = airq->guest_irq; |
186 | return 0; | 186 | return 0; |
@@ -207,7 +207,8 @@ static int assigned_device_update_intx(struct kvm *kvm, | |||
207 | return -EIO; | 207 | return -EIO; |
208 | } | 208 | } |
209 | 209 | ||
210 | adev->irq_requested = true; | 210 | adev->irq_requested_type = KVM_ASSIGNED_DEV_GUEST_INTX | |
211 | KVM_ASSIGNED_DEV_HOST_INTX; | ||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
213 | 214 | ||
@@ -227,7 +228,7 @@ static int kvm_vm_ioctl_assign_irq(struct kvm *kvm, | |||
227 | return -EINVAL; | 228 | return -EINVAL; |
228 | } | 229 | } |
229 | 230 | ||
230 | if (!match->irq_requested) { | 231 | if (!match->irq_requested_type) { |
231 | INIT_WORK(&match->interrupt_work, | 232 | INIT_WORK(&match->interrupt_work, |
232 | kvm_assigned_dev_interrupt_work_handler); | 233 | kvm_assigned_dev_interrupt_work_handler); |
233 | if (irqchip_in_kernel(kvm)) { | 234 | if (irqchip_in_kernel(kvm)) { |