diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2011-09-11 04:16:20 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-09-25 12:52:39 -0400 |
commit | c61fa9d63b40b06522c5f1d940b084323a090688 (patch) | |
tree | dbabc88d4096a9f155794a6bb48d8ac5274bc1fa /virt/kvm/assigned-dev.c | |
parent | 9f9f6b78776be3de02e0c7533924e6954b918123 (diff) |
KVM: Avoid needless registrations of IRQ ack notifier for assigned devices
We only perform work in kvm_assigned_dev_ack_irq if the guest IRQ is of
INTx type. This completely avoids the callback invocation in non-INTx
cases by registering the IRQ ack notifier only for INTx.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/assigned-dev.c')
-rw-r--r-- | virt/kvm/assigned-dev.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index ea1bf5d424ea..84ead5489650 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
@@ -86,13 +86,9 @@ static irqreturn_t kvm_assigned_dev_thread(int irq, void *dev_id) | |||
86 | /* Ack the irq line for an assigned device */ | 86 | /* Ack the irq line for an assigned device */ |
87 | static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian) | 87 | static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian) |
88 | { | 88 | { |
89 | struct kvm_assigned_dev_kernel *dev; | 89 | struct kvm_assigned_dev_kernel *dev = |
90 | 90 | container_of(kian, struct kvm_assigned_dev_kernel, | |
91 | if (kian->gsi == -1) | 91 | ack_notifier); |
92 | return; | ||
93 | |||
94 | dev = container_of(kian, struct kvm_assigned_dev_kernel, | ||
95 | ack_notifier); | ||
96 | 92 | ||
97 | kvm_set_irq(dev->kvm, dev->irq_source_id, dev->guest_irq, 0); | 93 | kvm_set_irq(dev->kvm, dev->irq_source_id, dev->guest_irq, 0); |
98 | 94 | ||
@@ -110,8 +106,9 @@ static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian) | |||
110 | static void deassign_guest_irq(struct kvm *kvm, | 106 | static void deassign_guest_irq(struct kvm *kvm, |
111 | struct kvm_assigned_dev_kernel *assigned_dev) | 107 | struct kvm_assigned_dev_kernel *assigned_dev) |
112 | { | 108 | { |
113 | kvm_unregister_irq_ack_notifier(kvm, &assigned_dev->ack_notifier); | 109 | if (assigned_dev->ack_notifier.gsi != -1) |
114 | assigned_dev->ack_notifier.gsi = -1; | 110 | kvm_unregister_irq_ack_notifier(kvm, |
111 | &assigned_dev->ack_notifier); | ||
115 | 112 | ||
116 | kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id, | 113 | kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id, |
117 | assigned_dev->guest_irq, 0); | 114 | assigned_dev->guest_irq, 0); |
@@ -404,7 +401,8 @@ static int assign_guest_irq(struct kvm *kvm, | |||
404 | 401 | ||
405 | if (!r) { | 402 | if (!r) { |
406 | dev->irq_requested_type |= guest_irq_type; | 403 | dev->irq_requested_type |= guest_irq_type; |
407 | kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier); | 404 | if (dev->ack_notifier.gsi != -1) |
405 | kvm_register_irq_ack_notifier(kvm, &dev->ack_notifier); | ||
408 | } else | 406 | } else |
409 | kvm_free_irq_source_id(kvm, dev->irq_source_id); | 407 | kvm_free_irq_source_id(kvm, dev->irq_source_id); |
410 | 408 | ||