|
Mark McLoughlin |
ef961d |
From 80380f566e2c1d4c9e02e0c0dff405ecc86d134e Mon Sep 17 00:00:00 2001
|
|
Mark McLoughlin |
dc5736 |
From: Michael S. Tsirkin <mst@redhat.com>
|
|
Mark McLoughlin |
dc5736 |
Date: Thu, 23 Jul 2009 16:34:13 +0300
|
|
Mark McLoughlin |
dc5736 |
Subject: [PATCH] Fix error handling in msix vector add
|
|
Mark McLoughlin |
dc5736 |
|
|
Mark McLoughlin |
dc5736 |
When adding a vector fails, the used counter should
|
|
Mark McLoughlin |
dc5736 |
not be incremented, otherwise on vector change we will
|
|
Mark McLoughlin |
dc5736 |
try to update the routing entry.
|
|
Mark McLoughlin |
dc5736 |
|
|
Mark McLoughlin |
dc5736 |
(cherry picked from commit aca6915d92743b11ac5555d6e412cc4737f27f34)
|
|
Mark McLoughlin |
dc5736 |
|
|
Mark McLoughlin |
dc5736 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Mark McLoughlin |
dc5736 |
Signed-off-by: Avi Kivity <avi@redhat.com>
|
|
Mark McLoughlin |
dc5736 |
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
|
|
Mark McLoughlin |
dc5736 |
Fedora-patch: qemu-fix-msix-error-handling-on-older-kernels.patch
|
|
Mark McLoughlin |
dc5736 |
---
|
|
Mark McLoughlin |
dc5736 |
hw/msix.c | 10 ++++++++--
|
|
Mark McLoughlin |
dc5736 |
1 files changed, 8 insertions(+), 2 deletions(-)
|
|
Mark McLoughlin |
dc5736 |
|
|
Mark McLoughlin |
dc5736 |
diff --git a/hw/msix.c b/hw/msix.c
|
|
Mark McLoughlin |
dc5736 |
index 974268d..b6c3f17 100644
|
|
Mark McLoughlin |
dc5736 |
--- a/hw/msix.c
|
|
Mark McLoughlin |
dc5736 |
+++ b/hw/msix.c
|
|
Mark McLoughlin |
dc5736 |
@@ -503,13 +503,19 @@ void msix_reset(PCIDevice *dev)
|
|
Mark McLoughlin |
dc5736 |
/* Mark vector as used. */
|
|
Mark McLoughlin |
dc5736 |
int msix_vector_use(PCIDevice *dev, unsigned vector)
|
|
Mark McLoughlin |
dc5736 |
{
|
|
Mark McLoughlin |
dc5736 |
+ int ret;
|
|
Mark McLoughlin |
dc5736 |
if (vector >= dev->msix_entries_nr)
|
|
Mark McLoughlin |
dc5736 |
return -EINVAL;
|
|
Mark McLoughlin |
dc5736 |
- if (dev->msix_entry_used[vector]++)
|
|
Mark McLoughlin |
dc5736 |
+ if (dev->msix_entry_used[vector]) {
|
|
Mark McLoughlin |
dc5736 |
return 0;
|
|
Mark McLoughlin |
dc5736 |
+ }
|
|
Mark McLoughlin |
dc5736 |
if (kvm_enabled() && qemu_kvm_irqchip_in_kernel()) {
|
|
Mark McLoughlin |
dc5736 |
- return kvm_msix_add(dev, vector);
|
|
Mark McLoughlin |
dc5736 |
+ ret = kvm_msix_add(dev, vector);
|
|
Mark McLoughlin |
dc5736 |
+ if (ret) {
|
|
Mark McLoughlin |
dc5736 |
+ return ret;
|
|
Mark McLoughlin |
dc5736 |
+ }
|
|
Mark McLoughlin |
dc5736 |
}
|
|
Mark McLoughlin |
dc5736 |
+ ++dev->msix_entry_used[vector];
|
|
Mark McLoughlin |
dc5736 |
return 0;
|
|
Mark McLoughlin |
dc5736 |
}
|
|
Mark McLoughlin |
dc5736 |
|
|
Mark McLoughlin |
dc5736 |
--
|
|
Mark McLoughlin |
dc5736 |
1.6.2.5
|
|
Mark McLoughlin |
dc5736 |
|