linux-mips
[Top] [All Lists]

[PATCH 2/2] MIPS: Octeon: Disallow MSI-X interrupt and fall back to MSI

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH 2/2] MIPS: Octeon: Disallow MSI-X interrupt and fall back to MSI interrupts.
From: David Daney <ddaney@caviumnetworks.com>
Date: Mon, 26 Jul 2010 18:14:16 -0700
Cc: Chandrakala Chavva <cchavva@caviumnetworks.com>, David Daney <ddaney@caviumnetworks.com>
In-reply-to: <1280193256-16294-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1280193256-16294-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
From: Chandrakala Chavva <cchavva@caviumnetworks.com>

MSI-X interrupts are not supported yet for Octeon, return error if
MSI-X interrupts are requested by driver so that the driver will fall
back to use MSI interrupts.

Signed-off-by: Chandrakala Chavva <cchavva@caviumnetworks.com>
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/include/asm/pci.h |    5 +++++
 arch/mips/pci/msi-octeon.c  |   28 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 3beea14..576397c 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -140,6 +140,11 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev 
*dev, int channel)
        return channel ? 15 : 14;
 }
 
+#ifdef CONFIG_CPU_CAVIUM_OCTEON
+/* MSI arch hook for OCTEON */
+#define arch_setup_msi_irqs arch_setup_msi_irqs
+#endif
+
 extern int pci_probe_only;
 
 extern char * (*pcibios_plat_setup)(char *str);
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
index 7c75640..d808049 100644
--- a/arch/mips/pci/msi-octeon.c
+++ b/arch/mips/pci/msi-octeon.c
@@ -177,6 +177,34 @@ msi_irq_allocated:
        return 0;
 }
 
+int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
+{
+       struct msi_desc *entry;
+       int ret;
+
+       /*
+        * MSI-X is not supported.
+        */
+       if (type == PCI_CAP_ID_MSIX)
+               return -EINVAL;
+
+       /*
+        * If an architecture wants to support multiple MSI, it needs to
+        * override arch_setup_msi_irqs()
+        */
+       if (type == PCI_CAP_ID_MSI && nvec > 1)
+               return 1;
+
+       list_for_each_entry(entry, &dev->msi_list, list) {
+               ret = arch_setup_msi_irq(dev, entry);
+               if (ret < 0)
+                       return ret;
+               if (ret > 0)
+                       return -ENOSPC;
+       }
+
+       return 0;
+}
 
 /**
  * Called when a device no longer needs its MSI interrupts. All
-- 
1.7.1.1


<Prev in Thread] Current Thread [Next in Thread>