hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/mips/kernel/idle.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * MIPS idle loop and WAIT instruction support.
34 *
....@@ -5,11 +6,6 @@
56 * Copyright (C) 1994 - 2006 Ralf Baechle
67 * Copyright (C) 2003, 2004 Maciej W. Rozycki
78 * Copyright (C) 2001, 2004, 2011, 2012 MIPS Technologies, Inc.
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU General Public License
11
- * as published by the Free Software Foundation; either version
12
- * 2 of the License, or (at your option) any later version.
139 */
1410 #include <linux/cpu.h>
1511 #include <linux/export.h>
....@@ -37,19 +33,19 @@
3733 {
3834 unsigned long cfg = read_c0_conf();
3935 write_c0_conf(cfg | R30XX_CONF_HALT);
40
- local_irq_enable();
36
+ raw_local_irq_enable();
4137 }
4238
4339 static void __cpuidle r39xx_wait(void)
4440 {
4541 if (!need_resched())
4642 write_c0_conf(read_c0_conf() | TX39_CONF_HALT);
47
- local_irq_enable();
43
+ raw_local_irq_enable();
4844 }
4945
5046 void __cpuidle r4k_wait(void)
5147 {
52
- local_irq_enable();
48
+ raw_local_irq_enable();
5349 __r4k_wait();
5450 }
5551
....@@ -68,7 +64,7 @@
6864 " .set arch=r4000 \n"
6965 " wait \n"
7066 " .set pop \n");
71
- local_irq_enable();
67
+ raw_local_irq_enable();
7268 }
7369
7470 /*
....@@ -88,7 +84,7 @@
8884 " wait \n"
8985 " mtc0 $1, $12 # stalls until W stage \n"
9086 " .set pop \n");
91
- local_irq_enable();
87
+ raw_local_irq_enable();
9288 }
9389
9490 /*
....@@ -101,7 +97,8 @@
10197 unsigned long c0status = read_c0_status() | 1; /* irqs on */
10298
10399 __asm__(
104
- " .set arch=r4000 \n"
100
+ " .set push \n"
101
+ " .set arch=r4000 \n"
105102 " cache 0x14, 0(%0) \n"
106103 " cache 0x14, 32(%0) \n"
107104 " sync \n"
....@@ -111,7 +108,7 @@
111108 " nop \n"
112109 " nop \n"
113110 " nop \n"
114
- " .set mips0 \n"
111
+ " .set pop \n"
115112 : : "r" (au1k_wait), "r" (c0status));
116113 }
117114
....@@ -154,7 +151,6 @@
154151 cpu_wait = r39xx_wait;
155152 break;
156153 case CPU_R4200:
157
-/* case CPU_R4300: */
158154 case CPU_R4600:
159155 case CPU_R4640:
160156 case CPU_R4650:
....@@ -176,14 +172,16 @@
176172 case CPU_CAVIUM_OCTEON_PLUS:
177173 case CPU_CAVIUM_OCTEON2:
178174 case CPU_CAVIUM_OCTEON3:
179
- case CPU_JZRISC:
180
- case CPU_LOONGSON1:
175
+ case CPU_XBURST:
176
+ case CPU_LOONGSON32:
181177 case CPU_XLR:
182178 case CPU_XLP:
183179 cpu_wait = r4k_wait;
184180 break;
185
- case CPU_LOONGSON3:
186
- if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON3A_R2)
181
+ case CPU_LOONGSON64:
182
+ if ((c->processor_id & (PRID_IMP_MASK | PRID_REV_MASK)) >=
183
+ (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) ||
184
+ (c->processor_id & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64R)
187185 cpu_wait = r4k_wait;
188186 break;
189187
....@@ -204,7 +202,7 @@
204202 */
205203 if (IS_ENABLED(CONFIG_MIPS_EJTAG_FDC_TTY))
206204 break;
207
- /* fall through */
205
+ fallthrough;
208206 case CPU_M14KC:
209207 case CPU_M14KEC:
210208 case CPU_24K:
....@@ -259,7 +257,7 @@
259257 if (cpu_wait)
260258 cpu_wait();
261259 else
262
- local_irq_enable();
260
+ raw_local_irq_enable();
263261 }
264262
265263 #ifdef CONFIG_CPU_IDLE