aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-02-17 21:23:18 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-02-18 22:52:32 -0500
commit203041ad1f66d2afb893c2adb9c11bfd13209d06 (patch)
treef018d05a5b3503c35fdb0a542a2f7646a450dfb9 /arch/powerpc/sysdev/mpic.c
parentd0eab3eb557250cead42f22e6f1a4f7e326757f9 (diff)
powerpc: Convert mpic locks to raw_spinlock
mpic_lock, irq_rover_lock and fixup_lock need to be real spinlocks in RT. Convert them to raw_spinlock. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 314f0fa46924..339e8a3e26d2 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -46,7 +46,7 @@
46 46
47static struct mpic *mpics; 47static struct mpic *mpics;
48static struct mpic *mpic_primary; 48static struct mpic *mpic_primary;
49static DEFINE_SPINLOCK(mpic_lock); 49static DEFINE_RAW_SPINLOCK(mpic_lock);
50 50
51#ifdef CONFIG_PPC32 /* XXX for now */ 51#ifdef CONFIG_PPC32 /* XXX for now */
52#ifdef CONFIG_IRQ_ALL_CPUS 52#ifdef CONFIG_IRQ_ALL_CPUS
@@ -347,10 +347,10 @@ static inline void mpic_ht_end_irq(struct mpic *mpic, unsigned int source)
347 unsigned int mask = 1U << (fixup->index & 0x1f); 347 unsigned int mask = 1U << (fixup->index & 0x1f);
348 writel(mask, fixup->applebase + soff); 348 writel(mask, fixup->applebase + soff);
349 } else { 349 } else {
350 spin_lock(&mpic->fixup_lock); 350 raw_spin_lock(&mpic->fixup_lock);
351 writeb(0x11 + 2 * fixup->index, fixup->base + 2); 351 writeb(0x11 + 2 * fixup->index, fixup->base + 2);
352 writel(fixup->data, fixup->base + 4); 352 writel(fixup->data, fixup->base + 4);
353 spin_unlock(&mpic->fixup_lock); 353 raw_spin_unlock(&mpic->fixup_lock);
354 } 354 }
355} 355}
356 356
@@ -366,7 +366,7 @@ static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source,
366 366
367 DBG("startup_ht_interrupt(0x%x, 0x%x) index: %d\n", 367 DBG("startup_ht_interrupt(0x%x, 0x%x) index: %d\n",
368 source, irqflags, fixup->index); 368 source, irqflags, fixup->index);
369 spin_lock_irqsave(&mpic->fixup_lock, flags); 369 raw_spin_lock_irqsave(&mpic->fixup_lock, flags);
370 /* Enable and configure */ 370 /* Enable and configure */
371 writeb(0x10 + 2 * fixup->index, fixup->base + 2); 371 writeb(0x10 + 2 * fixup->index, fixup->base + 2);
372 tmp = readl(fixup->base + 4); 372 tmp = readl(fixup->base + 4);
@@ -374,7 +374,7 @@ static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source,
374 if (irqflags & IRQ_LEVEL) 374 if (irqflags & IRQ_LEVEL)
375 tmp |= 0x22; 375 tmp |= 0x22;
376 writel(tmp, fixup->base + 4); 376 writel(tmp, fixup->base + 4);
377 spin_unlock_irqrestore(&mpic->fixup_lock, flags); 377 raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags);
378 378
379#ifdef CONFIG_PM 379#ifdef CONFIG_PM
380 /* use the lowest bit inverted to the actual HW, 380 /* use the lowest bit inverted to the actual HW,
@@ -396,12 +396,12 @@ static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source,
396 DBG("shutdown_ht_interrupt(0x%x, 0x%x)\n", source, irqflags); 396 DBG("shutdown_ht_interrupt(0x%x, 0x%x)\n", source, irqflags);
397 397
398 /* Disable */ 398 /* Disable */
399 spin_lock_irqsave(&mpic->fixup_lock, flags); 399 raw_spin_lock_irqsave(&mpic->fixup_lock, flags);
400 writeb(0x10 + 2 * fixup->index, fixup->base + 2); 400 writeb(0x10 + 2 * fixup->index, fixup->base + 2);
401 tmp = readl(fixup->base + 4); 401 tmp = readl(fixup->base + 4);
402 tmp |= 1; 402 tmp |= 1;
403 writel(tmp, fixup->base + 4); 403 writel(tmp, fixup->base + 4);
404 spin_unlock_irqrestore(&mpic->fixup_lock, flags); 404 raw_spin_unlock_irqrestore(&mpic->fixup_lock, flags);
405 405
406#ifdef CONFIG_PM 406#ifdef CONFIG_PM
407 /* use the lowest bit inverted to the actual HW, 407 /* use the lowest bit inverted to the actual HW,
@@ -515,7 +515,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
515 BUG_ON(mpic->fixups == NULL); 515 BUG_ON(mpic->fixups == NULL);
516 516
517 /* Init spinlock */ 517 /* Init spinlock */
518 spin_lock_init(&mpic->fixup_lock); 518 raw_spin_lock_init(&mpic->fixup_lock);
519 519
520 /* Map U3 config space. We assume all IO-APICs are on the primary bus 520 /* Map U3 config space. We assume all IO-APICs are on the primary bus
521 * so we only need to map 64kB. 521 * so we only need to map 64kB.
@@ -573,12 +573,12 @@ static int irq_choose_cpu(const cpumask_t *mask)
573 573
574 if (cpumask_equal(mask, cpu_all_mask)) { 574 if (cpumask_equal(mask, cpu_all_mask)) {
575 static int irq_rover; 575 static int irq_rover;
576 static DEFINE_SPINLOCK(irq_rover_lock); 576 static DEFINE_RAW_SPINLOCK(irq_rover_lock);
577 unsigned long flags; 577 unsigned long flags;
578 578
579 /* Round-robin distribution... */ 579 /* Round-robin distribution... */
580 do_round_robin: 580 do_round_robin:
581 spin_lock_irqsave(&irq_rover_lock, flags); 581 raw_spin_lock_irqsave(&irq_rover_lock, flags);
582 582
583 while (!cpu_online(irq_rover)) { 583 while (!cpu_online(irq_rover)) {
584 if (++irq_rover >= NR_CPUS) 584 if (++irq_rover >= NR_CPUS)
@@ -590,7 +590,7 @@ static int irq_choose_cpu(const cpumask_t *mask)
590 irq_rover = 0; 590 irq_rover = 0;
591 } while (!cpu_online(irq_rover)); 591 } while (!cpu_online(irq_rover));
592 592
593 spin_unlock_irqrestore(&irq_rover_lock, flags); 593 raw_spin_unlock_irqrestore(&irq_rover_lock, flags);
594 } else { 594 } else {
595 cpuid = cpumask_first_and(mask, cpu_online_mask); 595 cpuid = cpumask_first_and(mask, cpu_online_mask);
596 if (cpuid >= nr_cpu_ids) 596 if (cpuid >= nr_cpu_ids)
@@ -1368,14 +1368,14 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable)
1368 unsigned long flags; 1368 unsigned long flags;
1369 u32 v; 1369 u32 v;
1370 1370
1371 spin_lock_irqsave(&mpic_lock, flags); 1371 raw_spin_lock_irqsave(&mpic_lock, flags);
1372 v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); 1372 v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1);
1373 if (enable) 1373 if (enable)
1374 v |= MPIC_GREG_GLOBAL_CONF_1_SIE; 1374 v |= MPIC_GREG_GLOBAL_CONF_1_SIE;
1375 else 1375 else
1376 v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE; 1376 v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE;
1377 mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); 1377 mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v);
1378 spin_unlock_irqrestore(&mpic_lock, flags); 1378 raw_spin_unlock_irqrestore(&mpic_lock, flags);
1379} 1379}
1380 1380
1381void mpic_irq_set_priority(unsigned int irq, unsigned int pri) 1381void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
@@ -1388,7 +1388,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1388 if (!mpic) 1388 if (!mpic)
1389 return; 1389 return;
1390 1390
1391 spin_lock_irqsave(&mpic_lock, flags); 1391 raw_spin_lock_irqsave(&mpic_lock, flags);
1392 if (mpic_is_ipi(mpic, irq)) { 1392 if (mpic_is_ipi(mpic, irq)) {
1393 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & 1393 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
1394 ~MPIC_VECPRI_PRIORITY_MASK; 1394 ~MPIC_VECPRI_PRIORITY_MASK;
@@ -1400,7 +1400,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1400 mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), 1400 mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI),
1401 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 1401 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
1402 } 1402 }
1403 spin_unlock_irqrestore(&mpic_lock, flags); 1403 raw_spin_unlock_irqrestore(&mpic_lock, flags);
1404} 1404}
1405 1405
1406void mpic_setup_this_cpu(void) 1406void mpic_setup_this_cpu(void)
@@ -1415,7 +1415,7 @@ void mpic_setup_this_cpu(void)
1415 1415
1416 DBG("%s: setup_this_cpu(%d)\n", mpic->name, hard_smp_processor_id()); 1416 DBG("%s: setup_this_cpu(%d)\n", mpic->name, hard_smp_processor_id());
1417 1417
1418 spin_lock_irqsave(&mpic_lock, flags); 1418 raw_spin_lock_irqsave(&mpic_lock, flags);
1419 1419
1420 /* let the mpic know we want intrs. default affinity is 0xffffffff 1420 /* let the mpic know we want intrs. default affinity is 0xffffffff
1421 * until changed via /proc. That's how it's done on x86. If we want 1421 * until changed via /proc. That's how it's done on x86. If we want
@@ -1431,7 +1431,7 @@ void mpic_setup_this_cpu(void)
1431 /* Set current processor priority to 0 */ 1431 /* Set current processor priority to 0 */
1432 mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0); 1432 mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0);
1433 1433
1434 spin_unlock_irqrestore(&mpic_lock, flags); 1434 raw_spin_unlock_irqrestore(&mpic_lock, flags);
1435#endif /* CONFIG_SMP */ 1435#endif /* CONFIG_SMP */
1436} 1436}
1437 1437
@@ -1460,7 +1460,7 @@ void mpic_teardown_this_cpu(int secondary)
1460 BUG_ON(mpic == NULL); 1460 BUG_ON(mpic == NULL);
1461 1461
1462 DBG("%s: teardown_this_cpu(%d)\n", mpic->name, hard_smp_processor_id()); 1462 DBG("%s: teardown_this_cpu(%d)\n", mpic->name, hard_smp_processor_id());
1463 spin_lock_irqsave(&mpic_lock, flags); 1463 raw_spin_lock_irqsave(&mpic_lock, flags);
1464 1464
1465 /* let the mpic know we don't want intrs. */ 1465 /* let the mpic know we don't want intrs. */
1466 for (i = 0; i < mpic->num_sources ; i++) 1466 for (i = 0; i < mpic->num_sources ; i++)
@@ -1474,7 +1474,7 @@ void mpic_teardown_this_cpu(int secondary)
1474 */ 1474 */
1475 mpic_eoi(mpic); 1475 mpic_eoi(mpic);
1476 1476
1477 spin_unlock_irqrestore(&mpic_lock, flags); 1477 raw_spin_unlock_irqrestore(&mpic_lock, flags);
1478} 1478}
1479 1479
1480 1480