hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/powerpc/kernel/idle.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Idle daemon for PowerPC. Idle daemon will handle any action
34 * that needs to be taken when the system becomes idle.
....@@ -12,11 +13,6 @@
1213 * Copyright (c) 2003 Dave Engebretsen <engebret@us.ibm.com>
1314 *
1415 * 32-bit and 64-bit versions merged by Paul Mackerras <paulus@samba.org>
15
- *
16
- * This program is free software; you can redistribute it and/or
17
- * modify it under the terms of the GNU General Public License
18
- * as published by the Free Software Foundation; either version
19
- * 2 of the License, or (at your option) any later version.
2016 */
2117
2218 #include <linux/sched.h>
....@@ -41,17 +37,9 @@
4137 {
4238 ppc_md.power_save = NULL;
4339 cpuidle_disable = IDLE_POWERSAVE_OFF;
44
- return 0;
40
+ return 1;
4541 }
4642 __setup("powersave=off", powersave_off);
47
-
48
-#ifdef CONFIG_HOTPLUG_CPU
49
-void arch_cpu_idle_dead(void)
50
-{
51
- sched_preempt_enable_no_resched();
52
- cpu_die();
53
-}
54
-#endif
5543
5644 void arch_cpu_idle(void)
5745 {
....@@ -64,9 +52,9 @@
6452 * interrupts enabled, some don't.
6553 */
6654 if (irqs_disabled())
67
- local_irq_enable();
55
+ raw_local_irq_enable();
6856 } else {
69
- local_irq_enable();
57
+ raw_local_irq_enable();
7058 /*
7159 * Go into low thread priority and possibly
7260 * low power mode.
....@@ -81,6 +69,31 @@
8169
8270 int powersave_nap;
8371
72
+#ifdef CONFIG_PPC_970_NAP
73
+void power4_idle(void)
74
+{
75
+ if (!cpu_has_feature(CPU_FTR_CAN_NAP))
76
+ return;
77
+
78
+ if (!powersave_nap)
79
+ return;
80
+
81
+ if (!prep_irq_for_idle())
82
+ return;
83
+
84
+ if (cpu_has_feature(CPU_FTR_ALTIVEC))
85
+ asm volatile(PPC_DSSALL " ; sync" ::: "memory");
86
+
87
+ power4_idle_nap();
88
+
89
+ /*
90
+ * power4_idle_nap returns with interrupts enabled (soft and hard).
91
+ * to our caller with interrupts enabled (soft and hard). Our caller
92
+ * can cope with either interrupts disabled or enabled upon return.
93
+ */
94
+}
95
+#endif
96
+
8497 #ifdef CONFIG_SYSCTL
8598 /*
8699 * Register the sysctl to set/clear powersave_nap.