From c507b364854c06cc818b62e24ac9df08b92be9ba Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 12 Jul 2010 10:43:34 +0100 Subject: [PATCH] x86: prevent simultaneous use of MSI and MSI-X 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 --- xen/arch/x86/msi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index f6812b2f52..4f16bf23c4 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -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; } -- 2.39.5