hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/xtensa/kernel/smp.c
....@@ -53,16 +53,12 @@
5353 #define IPI_IRQ 0
5454
5555 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
-};
6156
6257 void ipi_init(void)
6358 {
6459 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);
6662 }
6763
6864 static inline unsigned int get_core_count(void)
....@@ -126,7 +122,7 @@
126122
127123 init_mmu();
128124
129
-#ifdef CONFIG_DEBUG_KERNEL
125
+#ifdef CONFIG_DEBUG_MISC
130126 if (boot_secondary_processors == 0) {
131127 pr_debug("%s: boot_secondary_processors:%d; Hanging cpu:%d\n",
132128 __func__, boot_secondary_processors, cpu);
....@@ -149,7 +145,6 @@
149145 cpumask_set_cpu(cpu, mm_cpumask(mm));
150146 enter_lazy_tlb(mm, current);
151147
152
- preempt_disable();
153148 trace_hardirqs_off();
154149
155150 calibrate_delay();
....@@ -372,8 +367,7 @@
372367 unsigned long mask = 0;
373368
374369 for_each_cpu(index, callmask)
375
- if (index != smp_processor_id())
376
- mask |= 1 << index;
370
+ mask |= 1 << index;
377371
378372 set_er(mask, MIPISET(msg_id));
379373 }
....@@ -412,22 +406,31 @@
412406 {
413407 unsigned int cpu = smp_processor_id();
414408 struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
415
- unsigned int msg;
416
- unsigned i;
417409
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();
423422 }
424423
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
+ }
431434
432435 return IRQ_HANDLED;
433436 }