diff options
| -rw-r--r-- | arch/powerpc/include/asm/mpic.h | 3 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/mpic.c | 72 |
2 files changed, 39 insertions, 36 deletions
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index 61913d9a21a0..e000cce8f6dd 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h | |||
| @@ -463,9 +463,6 @@ extern void mpic_cpu_set_priority(int prio); | |||
| 463 | /* Request IPIs on primary mpic */ | 463 | /* Request IPIs on primary mpic */ |
| 464 | extern void mpic_request_ipis(void); | 464 | extern void mpic_request_ipis(void); |
| 465 | 465 | ||
| 466 | /* Send an IPI (non offseted number 0..3) */ | ||
| 467 | extern void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask); | ||
| 468 | |||
| 469 | /* Send a message (IPI) to a given target (cpu number or MSG_*) */ | 466 | /* Send a message (IPI) to a given target (cpu number or MSG_*) */ |
| 470 | void smp_mpic_message_pass(int target, int msg); | 467 | void smp_mpic_message_pass(int target, int msg); |
| 471 | 468 | ||
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 260295b10557..2102487612a4 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
| @@ -568,12 +568,12 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic) | |||
| 568 | #endif /* CONFIG_MPIC_U3_HT_IRQS */ | 568 | #endif /* CONFIG_MPIC_U3_HT_IRQS */ |
| 569 | 569 | ||
| 570 | #ifdef CONFIG_SMP | 570 | #ifdef CONFIG_SMP |
| 571 | static int irq_choose_cpu(const cpumask_t *mask) | 571 | static int irq_choose_cpu(const struct cpumask *mask) |
| 572 | { | 572 | { |
| 573 | int cpuid; | 573 | int cpuid; |
| 574 | 574 | ||
| 575 | if (cpumask_equal(mask, cpu_all_mask)) { | 575 | if (cpumask_equal(mask, cpu_all_mask)) { |
| 576 | static int irq_rover; | 576 | static int irq_rover = 0; |
| 577 | static DEFINE_RAW_SPINLOCK(irq_rover_lock); | 577 | static DEFINE_RAW_SPINLOCK(irq_rover_lock); |
| 578 | unsigned long flags; | 578 | unsigned long flags; |
| 579 | 579 | ||
| @@ -581,15 +581,11 @@ static int irq_choose_cpu(const cpumask_t *mask) | |||
| 581 | do_round_robin: | 581 | do_round_robin: |
| 582 | raw_spin_lock_irqsave(&irq_rover_lock, flags); | 582 | raw_spin_lock_irqsave(&irq_rover_lock, flags); |
| 583 | 583 | ||
| 584 | while (!cpu_online(irq_rover)) { | 584 | irq_rover = cpumask_next(irq_rover, cpu_online_mask); |
| 585 | if (++irq_rover >= NR_CPUS) | 585 | if (irq_rover >= nr_cpu_ids) |
| 586 | irq_rover = 0; | 586 | irq_rover = cpumask_first(cpu_online_mask); |
| 587 | } | 587 | |
| 588 | cpuid = irq_rover; | 588 | cpuid = irq_rover; |
| 589 | do { | ||
| 590 | if (++irq_rover >= NR_CPUS) | ||
| 591 | irq_rover = 0; | ||
| 592 | } while (!cpu_online(irq_rover)); | ||
| 593 | 589 | ||
| 594 | raw_spin_unlock_irqrestore(&irq_rover_lock, flags); | 590 | raw_spin_unlock_irqrestore(&irq_rover_lock, flags); |
| 595 | } else { | 591 | } else { |
| @@ -601,7 +597,7 @@ static int irq_choose_cpu(const cpumask_t *mask) | |||
| 601 | return get_hard_smp_processor_id(cpuid); | 597 | return get_hard_smp_processor_id(cpuid); |
| 602 | } | 598 | } |
| 603 | #else | 599 | #else |
| 604 | static int irq_choose_cpu(const cpumask_t *mask) | 600 | static int irq_choose_cpu(const struct cpumask *mask) |
| 605 | { | 601 | { |
| 606 | return hard_smp_processor_id(); | 602 | return hard_smp_processor_id(); |
| 607 | } | 603 | } |
| @@ -814,12 +810,16 @@ int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask) | |||
| 814 | 810 | ||
| 815 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); | 811 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); |
| 816 | } else { | 812 | } else { |
| 817 | cpumask_t tmp; | 813 | cpumask_var_t tmp; |
| 818 | 814 | ||
| 819 | cpumask_and(&tmp, cpumask, cpu_online_mask); | 815 | alloc_cpumask_var(&tmp, GFP_KERNEL); |
| 816 | |||
| 817 | cpumask_and(tmp, cpumask, cpu_online_mask); | ||
| 820 | 818 | ||
| 821 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), | 819 | mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), |
| 822 | mpic_physmask(cpus_addr(tmp)[0])); | 820 | mpic_physmask(cpumask_bits(tmp)[0])); |
| 821 | |||
| 822 | free_cpumask_var(tmp); | ||
| 823 | } | 823 | } |
| 824 | 824 | ||
| 825 | return 0; | 825 | return 0; |
| @@ -1479,21 +1479,6 @@ void mpic_teardown_this_cpu(int secondary) | |||
| 1479 | } | 1479 | } |
| 1480 | 1480 | ||
| 1481 | 1481 | ||
| 1482 | void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask) | ||
| 1483 | { | ||
| 1484 | struct mpic *mpic = mpic_primary; | ||
| 1485 | |||
| 1486 | BUG_ON(mpic == NULL); | ||
| 1487 | |||
| 1488 | #ifdef DEBUG_IPI | ||
| 1489 | DBG("%s: send_ipi(ipi_no: %d)\n", mpic->name, ipi_no); | ||
| 1490 | #endif | ||
| 1491 | |||
| 1492 | mpic_cpu_write(MPIC_INFO(CPU_IPI_DISPATCH_0) + | ||
| 1493 | ipi_no * MPIC_INFO(CPU_IPI_DISPATCH_STRIDE), | ||
| 1494 | mpic_physmask(cpu_mask & cpus_addr(cpu_online_map)[0])); | ||
| 1495 | } | ||
| 1496 | |||
| 1497 | static unsigned int _mpic_get_one_irq(struct mpic *mpic, int reg) | 1482 | static unsigned int _mpic_get_one_irq(struct mpic *mpic, int reg) |
| 1498 | { | 1483 | { |
| 1499 | u32 src; | 1484 | u32 src; |
| @@ -1589,8 +1574,25 @@ void mpic_request_ipis(void) | |||
| 1589 | } | 1574 | } |
| 1590 | } | 1575 | } |
| 1591 | 1576 | ||
| 1577 | static void mpic_send_ipi(unsigned int ipi_no, const struct cpumask *cpu_mask) | ||
| 1578 | { | ||
| 1579 | struct mpic *mpic = mpic_primary; | ||
| 1580 | |||
| 1581 | BUG_ON(mpic == NULL); | ||
| 1582 | |||
| 1583 | #ifdef DEBUG_IPI | ||
| 1584 | DBG("%s: send_ipi(ipi_no: %d)\n", mpic->name, ipi_no); | ||
| 1585 | #endif | ||
| 1586 | |||
| 1587 | mpic_cpu_write(MPIC_INFO(CPU_IPI_DISPATCH_0) + | ||
| 1588 | ipi_no * MPIC_INFO(CPU_IPI_DISPATCH_STRIDE), | ||
| 1589 | mpic_physmask(cpumask_bits(cpu_mask)[0])); | ||
| 1590 | } | ||
| 1591 | |||
| 1592 | void smp_mpic_message_pass(int target, int msg) | 1592 | void smp_mpic_message_pass(int target, int msg) |
| 1593 | { | 1593 | { |
| 1594 | cpumask_var_t tmp; | ||
| 1595 | |||
| 1594 | /* make sure we're sending something that translates to an IPI */ | 1596 | /* make sure we're sending something that translates to an IPI */ |
| 1595 | if ((unsigned int)msg > 3) { | 1597 | if ((unsigned int)msg > 3) { |
| 1596 | printk("SMP %d: smp_message_pass: unknown msg %d\n", | 1598 | printk("SMP %d: smp_message_pass: unknown msg %d\n", |
| @@ -1599,13 +1601,17 @@ void smp_mpic_message_pass(int target, int msg) | |||
| 1599 | } | 1601 | } |
| 1600 | switch (target) { | 1602 | switch (target) { |
| 1601 | case MSG_ALL: | 1603 | case MSG_ALL: |
| 1602 | mpic_send_ipi(msg, 0xffffffff); | 1604 | mpic_send_ipi(msg, cpu_online_mask); |
| 1603 | break; | 1605 | break; |
| 1604 | case MSG_ALL_BUT_SELF: | 1606 | case MSG_ALL_BUT_SELF: |
| 1605 | mpic_send_ipi(msg, 0xffffffff & ~(1 << smp_processor_id())); | 1607 | alloc_cpumask_var(&tmp, GFP_NOWAIT); |
| 1608 | cpumask_andnot(tmp, cpu_online_mask, | ||
| 1609 | cpumask_of(smp_processor_id())); | ||
| 1610 | mpic_send_ipi(msg, tmp); | ||
| 1611 | free_cpumask_var(tmp); | ||
| 1606 | break; | 1612 | break; |
| 1607 | default: | 1613 | default: |
| 1608 | mpic_send_ipi(msg, 1 << target); | 1614 | mpic_send_ipi(msg, cpumask_of(target)); |
| 1609 | break; | 1615 | break; |
| 1610 | } | 1616 | } |
| 1611 | } | 1617 | } |
| @@ -1616,7 +1622,7 @@ int __init smp_mpic_probe(void) | |||
| 1616 | 1622 | ||
| 1617 | DBG("smp_mpic_probe()...\n"); | 1623 | DBG("smp_mpic_probe()...\n"); |
| 1618 | 1624 | ||
| 1619 | nr_cpus = cpus_weight(cpu_possible_map); | 1625 | nr_cpus = cpumask_weight(cpu_possible_mask); |
| 1620 | 1626 | ||
| 1621 | DBG("nr_cpus: %d\n", nr_cpus); | 1627 | DBG("nr_cpus: %d\n", nr_cpus); |
| 1622 | 1628 | ||
