aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Daney <ddaney@caviumnetworks.com>2010-07-23 13:43:49 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-08-05 08:26:11 -0400
commit7d9eee6e52e817c006666b0efc5068aa219dbecb (patch)
tree8646f4a81ee17a3977b6114f31002fd7d1af0dc1
parenta5decf700be1123c2da6bdab5099bce072c55cc2 (diff)
MIPS: Octeon: Make MSI use handle_simple_irq().
The use of handle_percpu_irq() is not really what we want for MSI, use handle_simple_irq() instead. This is probably the prototypical case for using handle_simple_irq(), because all the MSIs are dispatched from the root interrupt service routine. Also since the base IRQ is not shared, don't pass IRQF_SHARED. Signed-off-by: David Daney <ddaney@caviumnetworks.com> To: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/1488/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/pci/msi-octeon.c61
1 files changed, 15 insertions, 46 deletions
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
index 5ce1a6a6494a..83ceb52d6e0e 100644
--- a/arch/mips/pci/msi-octeon.c
+++ b/arch/mips/pci/msi-octeon.c
@@ -228,22 +228,20 @@ static irqreturn_t octeon_msi_interrupt(int cpl, void *dev_id)
228 irq = fls64(msi_bits); 228 irq = fls64(msi_bits);
229 if (irq) { 229 if (irq) {
230 irq += OCTEON_IRQ_MSI_BIT0 - 1; 230 irq += OCTEON_IRQ_MSI_BIT0 - 1;
231 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
232 /* These chips have PCIe */
233 cvmx_write_csr(CVMX_PEXP_NPEI_MSI_RCV0,
234 1ull << (irq - OCTEON_IRQ_MSI_BIT0));
235 } else {
236 /* These chips have PCI */
237 cvmx_write_csr(CVMX_NPI_NPI_MSI_RCV,
238 1ull << (irq - OCTEON_IRQ_MSI_BIT0));
239 }
231 if (irq_desc[irq].action) { 240 if (irq_desc[irq].action) {
232 do_IRQ(irq); 241 do_IRQ(irq);
233 return IRQ_HANDLED; 242 return IRQ_HANDLED;
234 } else { 243 } else {
235 pr_err("Spurious MSI interrupt %d\n", irq); 244 pr_err("Spurious MSI interrupt %d\n", irq);
236 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
237 /* These chips have PCIe */
238 cvmx_write_csr(CVMX_PEXP_NPEI_MSI_RCV0,
239 1ull << (irq -
240 OCTEON_IRQ_MSI_BIT0));
241 } else {
242 /* These chips have PCI */
243 cvmx_write_csr(CVMX_NPI_NPI_MSI_RCV,
244 1ull << (irq -
245 OCTEON_IRQ_MSI_BIT0));
246 }
247 } 245 }
248 } 246 }
249 return IRQ_NONE; 247 return IRQ_NONE;
@@ -251,27 +249,6 @@ static irqreturn_t octeon_msi_interrupt(int cpl, void *dev_id)
251 249
252static DEFINE_RAW_SPINLOCK(octeon_irq_msi_lock); 250static DEFINE_RAW_SPINLOCK(octeon_irq_msi_lock);
253 251
254static void octeon_irq_msi_ack(unsigned int irq)
255{
256 if (!octeon_has_feature(OCTEON_FEATURE_PCIE)) {
257 /* These chips have PCI */
258 cvmx_write_csr(CVMX_NPI_NPI_MSI_RCV,
259 1ull << (irq - OCTEON_IRQ_MSI_BIT0));
260 } else {
261 /*
262 * These chips have PCIe. Thankfully the ACK doesn't
263 * need any locking.
264 */
265 cvmx_write_csr(CVMX_PEXP_NPEI_MSI_RCV0,
266 1ull << (irq - OCTEON_IRQ_MSI_BIT0));
267 }
268}
269
270static void octeon_irq_msi_eoi(unsigned int irq)
271{
272 /* Nothing needed */
273}
274
275static void octeon_irq_msi_enable(unsigned int irq) 252static void octeon_irq_msi_enable(unsigned int irq)
276{ 253{
277 if (!octeon_has_feature(OCTEON_FEATURE_PCIE)) { 254 if (!octeon_has_feature(OCTEON_FEATURE_PCIE)) {
@@ -326,8 +303,6 @@ static struct irq_chip octeon_irq_chip_msi = {
326 .name = "MSI", 303 .name = "MSI",
327 .enable = octeon_irq_msi_enable, 304 .enable = octeon_irq_msi_enable,
328 .disable = octeon_irq_msi_disable, 305 .disable = octeon_irq_msi_disable,
329 .ack = octeon_irq_msi_ack,
330 .eoi = octeon_irq_msi_eoi,
331}; 306};
332 307
333/* 308/*
@@ -338,34 +313,28 @@ static int __init octeon_msi_initialize(void)
338 int irq; 313 int irq;
339 314
340 for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_LAST; irq++) { 315 for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_LAST; irq++) {
341 set_irq_chip_and_handler(irq, &octeon_irq_chip_msi, 316 set_irq_chip_and_handler(irq, &octeon_irq_chip_msi, handle_simple_irq);
342 handle_percpu_irq);
343 } 317 }
344 318
345 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) { 319 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
346 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt, 320 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt,
347 IRQF_SHARED, 321 0, "MSI[0:63]", octeon_msi_interrupt))
348 "MSI[0:63]", octeon_msi_interrupt))
349 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed"); 322 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
350 } else if (octeon_is_pci_host()) { 323 } else if (octeon_is_pci_host()) {
351 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt, 324 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt,
352 IRQF_SHARED, 325 0, "MSI[0:15]", octeon_msi_interrupt))
353 "MSI[0:15]", octeon_msi_interrupt))
354 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed"); 326 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
355 327
356 if (request_irq(OCTEON_IRQ_PCI_MSI1, octeon_msi_interrupt, 328 if (request_irq(OCTEON_IRQ_PCI_MSI1, octeon_msi_interrupt,
357 IRQF_SHARED, 329 0, "MSI[16:31]", octeon_msi_interrupt))
358 "MSI[16:31]", octeon_msi_interrupt))
359 panic("request_irq(OCTEON_IRQ_PCI_MSI1) failed"); 330 panic("request_irq(OCTEON_IRQ_PCI_MSI1) failed");
360 331
361 if (request_irq(OCTEON_IRQ_PCI_MSI2, octeon_msi_interrupt, 332 if (request_irq(OCTEON_IRQ_PCI_MSI2, octeon_msi_interrupt,
362 IRQF_SHARED, 333 0, "MSI[32:47]", octeon_msi_interrupt))
363 "MSI[32:47]", octeon_msi_interrupt))
364 panic("request_irq(OCTEON_IRQ_PCI_MSI2) failed"); 334 panic("request_irq(OCTEON_IRQ_PCI_MSI2) failed");
365 335
366 if (request_irq(OCTEON_IRQ_PCI_MSI3, octeon_msi_interrupt, 336 if (request_irq(OCTEON_IRQ_PCI_MSI3, octeon_msi_interrupt,
367 IRQF_SHARED, 337 0, "MSI[48:63]", octeon_msi_interrupt))
368 "MSI[48:63]", octeon_msi_interrupt))
369 panic("request_irq(OCTEON_IRQ_PCI_MSI3) failed"); 338 panic("request_irq(OCTEON_IRQ_PCI_MSI3) failed");
370 339
371 } 340 }