Skip to content

Commit 13b7ea6

Browse files
Markos Chandrasralfbaechle
authored andcommitted
MIPS: malta: Fix GIC interrupt offsets
The GIC interrupt offsets are calculated based on the value of NR_CPUS. However, this is wrong because NR_CPUS may or may not contain the real number of the actual cpus present in the system. We fix that by using the 'nr_cpu_ids' variable which contains the real number of cpus in the system. Previously, an MT core (eg with 8 VPEs) will fail to boot if NR_CPUS was > 8 with the following errors: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at kernel/irq/chip.c:670 __irq_set_handler+0x15c/0x164() Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 3.12.0-rc5-00087-gced5633 5 Stack : 00000006 00000004 00000000 00000000 00000000 00000000 807a4f36 00000053 807a0000 00000000 80173218 80565aa8 00000000 00000000 00000000 0000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000 00000000 00000000 00000000 8054fd00 8054fd94 80500514 805657a7 8016eb4 807a0000 80500514 00000000 00000000 80565aa8 8079a5d8 80565766 8054fd0 ... Call Trace: [<801098c0>] show_stack+0x64/0x7c [<8049c6b0>] dump_stack+0x64/0x84 [<8012efc4>] warn_slowpath_common+0x84/0xb4 [<8012f00c>] warn_slowpath_null+0x18/0x24 [<80173218>] __irq_set_handler+0x15c/0x164 [<80587cf4>] arch_init_ipiirq+0x2c/0x3c [<805880c8>] arch_init_irq+0x3c4/0x4bc [<80588e28>] init_IRQ+0x3c/0x50 [<805847e8>] start_kernel+0x230/0x3d8 ---[ end trace 4eaa2a86a8e2da26 ]--- This is now fixed and the Malta board can boot with any NR_CPUS value which also helps supporting more processors in a single kernel binary. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6091/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 7f081f1 commit 13b7ea6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎arch/mips/mti-malta/malta-int.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ static void __init fill_ipi_map(void)
473473
{
474474
int cpu;
475475

476-
for (cpu = 0; cpu < NR_CPUS; cpu++) {
476+
for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
477477
fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1);
478478
fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2);
479479
}
@@ -574,8 +574,9 @@ void __init arch_init_irq(void)
574574
/* FIXME */
575575
int i;
576576
#if defined(CONFIG_MIPS_MT_SMP)
577-
gic_call_int_base = GIC_NUM_INTRS - NR_CPUS;
578-
gic_resched_int_base = gic_call_int_base - NR_CPUS;
577+
gic_call_int_base = GIC_NUM_INTRS -
578+
(NR_CPUS - nr_cpu_ids) * 2 - nr_cpu_ids;
579+
gic_resched_int_base = gic_call_int_base - nr_cpu_ids;
579580
fill_ipi_map();
580581
#endif
581582
gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map,
@@ -599,7 +600,7 @@ void __init arch_init_irq(void)
599600
printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status());
600601
write_c0_status(0x1100dc00);
601602
printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status());
602-
for (i = 0; i < NR_CPUS; i++) {
603+
for (i = 0; i < nr_cpu_ids; i++) {
603604
arch_init_ipiirq(MIPS_GIC_IRQ_BASE +
604605
GIC_RESCHED_INT(i), &irq_resched);
605606
arch_init_ipiirq(MIPS_GIC_IRQ_BASE +

0 commit comments

Comments
 (0)