forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/parisc/kernel/irq.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Code to handle x86 style IRQs plus some generic interrupt stuff.
34 *
....@@ -6,20 +7,6 @@
67 * Copyright (C) 1999 SuSE GmbH (Philipp Rumpf, prumpf@tux.org)
78 * Copyright (C) 1999-2000 Grant Grundler
89 * Copyright (c) 2005 Matthew Wilcox
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2, or (at your option)
13
- * any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2310 */
2411 #include <linux/bitops.h>
2512 #include <linux/errno.h>
....@@ -117,7 +104,10 @@
117104 return -EINVAL;
118105
119106 /* whatever mask they set, we just allow one CPU */
120
- cpu_dest = cpumask_first_and(dest, cpu_online_mask);
107
+ cpu_dest = cpumask_next_and(d->irq & (num_online_cpus()-1),
108
+ dest, cpu_online_mask);
109
+ if (cpu_dest >= nr_cpu_ids)
110
+ cpu_dest = cpumask_first_and(dest, cpu_online_mask);
121111
122112 return cpu_dest;
123113 }
....@@ -175,10 +165,16 @@
175165 # endif
176166 #endif
177167 #ifdef CONFIG_SMP
178
- seq_printf(p, "%*s: ", prec, "RES");
179
- for_each_online_cpu(j)
180
- seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count);
181
- seq_puts(p, " Rescheduling interrupts\n");
168
+ if (num_online_cpus() > 1) {
169
+ seq_printf(p, "%*s: ", prec, "RES");
170
+ for_each_online_cpu(j)
171
+ seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count);
172
+ seq_puts(p, " Rescheduling interrupts\n");
173
+ seq_printf(p, "%*s: ", prec, "CAL");
174
+ for_each_online_cpu(j)
175
+ seq_printf(p, "%10u ", irq_stats(j)->irq_call_count);
176
+ seq_puts(p, " Function call interrupts\n");
177
+ }
182178 #endif
183179 seq_printf(p, "%*s: ", prec, "UAH");
184180 for_each_online_cpu(j)
....@@ -392,7 +388,7 @@
392388 volatile unsigned int lock[1];
393389 };
394390
395
-DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = {
391
+static DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = {
396392 .slock = { 1,1,1,1 },
397393 };
398394 #endif
....@@ -568,33 +564,23 @@
568564 goto out;
569565 }
570566
571
-static struct irqaction timer_action = {
572
- .handler = timer_interrupt,
573
- .name = "timer",
574
- .flags = IRQF_TIMER | IRQF_PERCPU | IRQF_IRQPOLL,
575
-};
576
-
577
-#ifdef CONFIG_SMP
578
-static struct irqaction ipi_action = {
579
- .handler = ipi_interrupt,
580
- .name = "IPI",
581
- .flags = IRQF_PERCPU,
582
-};
583
-#endif
584
-
585567 static void claim_cpu_irqs(void)
586568 {
569
+ unsigned long flags = IRQF_TIMER | IRQF_PERCPU | IRQF_IRQPOLL;
587570 int i;
571
+
588572 for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) {
589573 irq_set_chip_and_handler(i, &cpu_interrupt_type,
590574 handle_percpu_irq);
591575 }
592576
593577 irq_set_handler(TIMER_IRQ, handle_percpu_irq);
594
- setup_irq(TIMER_IRQ, &timer_action);
578
+ if (request_irq(TIMER_IRQ, timer_interrupt, flags, "timer", NULL))
579
+ pr_err("Failed to register timer interrupt\n");
595580 #ifdef CONFIG_SMP
596581 irq_set_handler(IPI_IRQ, handle_percpu_irq);
597
- setup_irq(IPI_IRQ, &ipi_action);
582
+ if (request_irq(IPI_IRQ, ipi_interrupt, IRQF_PERCPU, "IPI", NULL))
583
+ pr_err("Failed to register IPI interrupt\n");
598584 #endif
599585 }
600586