| .. | .. |
|---|
| 53 | 53 | #define IPI_IRQ 0 |
|---|
| 54 | 54 | |
|---|
| 55 | 55 | static irqreturn_t ipi_interrupt(int irq, void *dev_id); |
|---|
| 56 | | -static struct irqaction ipi_irqaction = { |
|---|
| 57 | | - .handler = ipi_interrupt, |
|---|
| 58 | | - .flags = IRQF_PERCPU, |
|---|
| 59 | | - .name = "ipi", |
|---|
| 60 | | -}; |
|---|
| 61 | 56 | |
|---|
| 62 | 57 | void ipi_init(void) |
|---|
| 63 | 58 | { |
|---|
| 64 | 59 | unsigned irq = irq_create_mapping(NULL, IPI_IRQ); |
|---|
| 65 | | - setup_irq(irq, &ipi_irqaction); |
|---|
| 60 | + if (request_irq(irq, ipi_interrupt, IRQF_PERCPU, "ipi", NULL)) |
|---|
| 61 | + pr_err("Failed to request irq %u (ipi)\n", irq); |
|---|
| 66 | 62 | } |
|---|
| 67 | 63 | |
|---|
| 68 | 64 | static inline unsigned int get_core_count(void) |
|---|
| .. | .. |
|---|
| 126 | 122 | |
|---|
| 127 | 123 | init_mmu(); |
|---|
| 128 | 124 | |
|---|
| 129 | | -#ifdef CONFIG_DEBUG_KERNEL |
|---|
| 125 | +#ifdef CONFIG_DEBUG_MISC |
|---|
| 130 | 126 | if (boot_secondary_processors == 0) { |
|---|
| 131 | 127 | pr_debug("%s: boot_secondary_processors:%d; Hanging cpu:%d\n", |
|---|
| 132 | 128 | __func__, boot_secondary_processors, cpu); |
|---|
| .. | .. |
|---|
| 149 | 145 | cpumask_set_cpu(cpu, mm_cpumask(mm)); |
|---|
| 150 | 146 | enter_lazy_tlb(mm, current); |
|---|
| 151 | 147 | |
|---|
| 152 | | - preempt_disable(); |
|---|
| 153 | 148 | trace_hardirqs_off(); |
|---|
| 154 | 149 | |
|---|
| 155 | 150 | calibrate_delay(); |
|---|
| .. | .. |
|---|
| 372 | 367 | unsigned long mask = 0; |
|---|
| 373 | 368 | |
|---|
| 374 | 369 | for_each_cpu(index, callmask) |
|---|
| 375 | | - if (index != smp_processor_id()) |
|---|
| 376 | | - mask |= 1 << index; |
|---|
| 370 | + mask |= 1 << index; |
|---|
| 377 | 371 | |
|---|
| 378 | 372 | set_er(mask, MIPISET(msg_id)); |
|---|
| 379 | 373 | } |
|---|
| .. | .. |
|---|
| 412 | 406 | { |
|---|
| 413 | 407 | unsigned int cpu = smp_processor_id(); |
|---|
| 414 | 408 | struct ipi_data *ipi = &per_cpu(ipi_data, cpu); |
|---|
| 415 | | - unsigned int msg; |
|---|
| 416 | | - unsigned i; |
|---|
| 417 | 409 | |
|---|
| 418 | | - msg = get_er(MIPICAUSE(cpu)); |
|---|
| 419 | | - for (i = 0; i < IPI_MAX; i++) |
|---|
| 420 | | - if (msg & (1 << i)) { |
|---|
| 421 | | - set_er(1 << i, MIPICAUSE(cpu)); |
|---|
| 422 | | - ++ipi->ipi_count[i]; |
|---|
| 410 | + for (;;) { |
|---|
| 411 | + unsigned int msg; |
|---|
| 412 | + |
|---|
| 413 | + msg = get_er(MIPICAUSE(cpu)); |
|---|
| 414 | + set_er(msg, MIPICAUSE(cpu)); |
|---|
| 415 | + |
|---|
| 416 | + if (!msg) |
|---|
| 417 | + break; |
|---|
| 418 | + |
|---|
| 419 | + if (msg & (1 << IPI_CALL_FUNC)) { |
|---|
| 420 | + ++ipi->ipi_count[IPI_CALL_FUNC]; |
|---|
| 421 | + generic_smp_call_function_interrupt(); |
|---|
| 423 | 422 | } |
|---|
| 424 | 423 | |
|---|
| 425 | | - if (msg & (1 << IPI_RESCHEDULE)) |
|---|
| 426 | | - scheduler_ipi(); |
|---|
| 427 | | - if (msg & (1 << IPI_CALL_FUNC)) |
|---|
| 428 | | - generic_smp_call_function_interrupt(); |
|---|
| 429 | | - if (msg & (1 << IPI_CPU_STOP)) |
|---|
| 430 | | - ipi_cpu_stop(cpu); |
|---|
| 424 | + if (msg & (1 << IPI_RESCHEDULE)) { |
|---|
| 425 | + ++ipi->ipi_count[IPI_RESCHEDULE]; |
|---|
| 426 | + scheduler_ipi(); |
|---|
| 427 | + } |
|---|
| 428 | + |
|---|
| 429 | + if (msg & (1 << IPI_CPU_STOP)) { |
|---|
| 430 | + ++ipi->ipi_count[IPI_CPU_STOP]; |
|---|
| 431 | + ipi_cpu_stop(cpu); |
|---|
| 432 | + } |
|---|
| 433 | + } |
|---|
| 431 | 434 | |
|---|
| 432 | 435 | return IRQ_HANDLED; |
|---|
| 433 | 436 | } |
|---|