|
38 | 38 | #include <linux/rcupdate.h>
|
39 | 39 | #include <linux/random.h>
|
40 | 40 | #include <linux/nmi.h>
|
| 41 | +#include <linux/sched/hotplug.h> |
41 | 42 |
|
42 | 43 | #include <asm/io.h>
|
43 | 44 | #include <asm/asm-offsets.h>
|
|
46 | 47 | #include <asm/pdc_chassis.h>
|
47 | 48 | #include <asm/unwind.h>
|
48 | 49 | #include <asm/sections.h>
|
| 50 | +#include <asm/cacheflush.h> |
49 | 51 |
|
50 | 52 | #define COMMAND_GLOBAL F_EXTEND(0xfffe0030)
|
51 | 53 | #define CMD_RESET 5 /* reset any module */
|
@@ -158,10 +160,29 @@ void release_thread(struct task_struct *dead_task)
|
158 | 160 | int running_on_qemu __ro_after_init;
|
159 | 161 | EXPORT_SYMBOL(running_on_qemu);
|
160 | 162 |
|
161 |
| -void __cpuidle arch_cpu_idle_dead(void) |
| 163 | +/* |
| 164 | + * Called from the idle thread for the CPU which has been shutdown. |
| 165 | + */ |
| 166 | +void arch_cpu_idle_dead(void) |
162 | 167 | {
|
163 |
| - /* nop on real hardware, qemu will offline CPU. */ |
164 |
| - asm volatile("or %%r31,%%r31,%%r31\n":::); |
| 168 | +#ifdef CONFIG_HOTPLUG_CPU |
| 169 | + idle_task_exit(); |
| 170 | + |
| 171 | + local_irq_disable(); |
| 172 | + |
| 173 | + /* Tell __cpu_die() that this CPU is now safe to dispose of. */ |
| 174 | + (void)cpu_report_death(); |
| 175 | + |
| 176 | + /* Ensure that the cache lines are written out. */ |
| 177 | + flush_cache_all_local(); |
| 178 | + flush_tlb_all_local(NULL); |
| 179 | + |
| 180 | + /* Let PDC firmware put CPU into firmware idle loop. */ |
| 181 | + __pdc_cpu_rendezvous(); |
| 182 | + |
| 183 | + pr_warn("PDC does not provide rendezvous function.\n"); |
| 184 | +#endif |
| 185 | + while (1); |
165 | 186 | }
|
166 | 187 |
|
167 | 188 | void __cpuidle arch_cpu_idle(void)
|
|
0 commit comments