qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/3] msi: Allow pre-existing MSI capabilities


From: Alex Williamson
Subject: [Qemu-devel] [PATCH 1/3] msi: Allow pre-existing MSI capabilities
Date: Mon, 01 Nov 2010 23:37:32 -0600
User-agent: StGIT/0.14.3

For use with device assignment, allow calling msi_init() on devices
with MSI capability already configured.

Signed-off-by: Alex Williamson <address@hidden>
---

 hw/msi.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/hw/msi.c b/hw/msi.c
index f03f519..0ad4e38 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -135,10 +135,16 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
         flags |= PCI_MSI_FLAGS_MASKBIT;
     }
 
+    config_offset = pci_find_capability(dev, PCI_CAP_ID_MSI);
+
     cap_size = msi_cap_sizeof(flags);
-    config_offset = pci_add_capability(dev, PCI_CAP_ID_MSI, offset, cap_size);
-    if (config_offset < 0) {
-        return config_offset;
+
+    if (!config_offset) {
+        config_offset = pci_add_capability(dev, PCI_CAP_ID_MSI,
+                                           offset, cap_size);
+        if (config_offset < 0) {
+            return config_offset;
+        }
     }
 
     dev->msi_cap = config_offset;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]