Commit 52a0f00b50ea360e3cf7e3281523c6a8aafc5761

Authored by Chandrakala Chavva
Committed by Ralf Baechle
1 parent 1aa2b2782a

MIPS: Octeon: Disallow MSI-X interrupt and fall back to MSI interrupts.

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>
To: linux-mips@linux-mips.org
Cc: David Daney <ddaney@caviumnetworks.com>
Patchwork: https://patchwork.linux-mips.org/patch/1506/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David Daney <ddaney@caviumnetworks.com>

Showing 2 changed files with 33 additions and 0 deletions Side-by-side Diff

arch/mips/include/asm/pci.h
... ... @@ -140,6 +140,11 @@
140 140 return channel ? 15 : 14;
141 141 }
142 142  
  143 +#ifdef CONFIG_CPU_CAVIUM_OCTEON
  144 +/* MSI arch hook for OCTEON */
  145 +#define arch_setup_msi_irqs arch_setup_msi_irqs
  146 +#endif
  147 +
143 148 extern int pci_probe_only;
144 149  
145 150 extern char * (*pcibios_plat_setup)(char *str);
arch/mips/pci/msi-octeon.c
... ... @@ -177,6 +177,34 @@
177 177 return 0;
178 178 }
179 179  
  180 +int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
  181 +{
  182 + struct msi_desc *entry;
  183 + int ret;
  184 +
  185 + /*
  186 + * MSI-X is not supported.
  187 + */
  188 + if (type == PCI_CAP_ID_MSIX)
  189 + return -EINVAL;
  190 +
  191 + /*
  192 + * If an architecture wants to support multiple MSI, it needs to
  193 + * override arch_setup_msi_irqs()
  194 + */
  195 + if (type == PCI_CAP_ID_MSI && nvec > 1)
  196 + return 1;
  197 +
  198 + list_for_each_entry(entry, &dev->msi_list, list) {
  199 + ret = arch_setup_msi_irq(dev, entry);
  200 + if (ret < 0)
  201 + return ret;
  202 + if (ret > 0)
  203 + return -ENOSPC;
  204 + }
  205 +
  206 + return 0;
  207 +}
180 208  
181 209 /**
182 210 * Called when a device no longer needs its MSI interrupts. All