]> xenbits.xensource.com Git - xen.git/commitdiff
x86: prevent simultaneous use of MSI and MSI-X
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Jul 2010 09:43:34 +0000 (10:43 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 12 Jul 2010 09:43:34 +0000 (10:43 +0100)
This matches similar checks done in Linux, since no good can come from
a domain trying to enable both MSI and MSI-X on the same device at the
same time.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/msi.c

index f6812b2f52e4548d0a53e1d8552537f675af084d..4f16bf23c4d1906cfa12aa9f0c4c7f6b9f25eb84 100644 (file)
@@ -623,6 +623,14 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc)
         return 0;
     }
 
+    if ( find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX) )
+    {
+        dprintk(XENLOG_WARNING, "MSI-X is already in use on "
+                "device %02x:%02x.%01x\n", msi->bus,
+                PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+        return 0;
+    }
+
     status = msi_capability_init(pdev, msi->irq, desc);
     return status;
 }
@@ -689,6 +697,14 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
         return 0;
     }
 
+    if ( find_msi_entry(pdev, -1, PCI_CAP_ID_MSI) )
+    {
+        dprintk(XENLOG_WARNING, "MSI is already in use on "
+                "device %02x:%02x.%01x\n", msi->bus,
+                PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+        return 0;
+    }
+
     status = msix_capability_init(pdev, msi, desc);
     return status;
 }