arm64 uses cpu_up() in the resume from hibernation code to ensure that the CPU on which the system hibernated is online. Provide a core function for this. [ tglx: Split out from the combo arm64 patch ]
Unified · Split
| @@ -93,6 +93,7 @@ int add_cpu(unsigned int cpu); · 92 unmodified lines | |||
| 93 | void notify_cpu_starting(unsigned int cpu); | 93 | void notify_cpu_starting(unsigned int cpu); |
| 94 | extern void cpu_maps_update_begin(void); | 94 | extern void cpu_maps_update_begin(void); |
| 95 | extern void cpu_maps_update_done(void); | 95 | extern void cpu_maps_update_done(void); |
| 96 | int bringup_hibernate_cpu(unsigned int sleep_cpu); | ||
| 96 | 97 | ||
| 97 | #else /* CONFIG_SMP */ | 98 | #else /* CONFIG_SMP */ |
| 98 | #define cpuhp_tasks_frozen 0 | 99 | #define cpuhp_tasks_frozen 0 |
| @@ -1275,6 +1275,29 @@ int add_cpu(unsigned int cpu) · 1274 unmodified lines | |||
| 1275 | } | 1275 | } |
| 1276 | EXPORT_SYMBOL_GPL(add_cpu); | 1276 | EXPORT_SYMBOL_GPL(add_cpu); |
| 1277 | 1277 | ||
| 1278 | /** | ||
| 1279 | * bringup_hibernate_cpu - Bring up the CPU that we hibernated on | ||
| 1280 | * @sleep_cpu: The cpu we hibernated on and should be brought up. | ||
| 1281 | * | ||
| 1282 | * On some architectures like arm64, we can hibernate on any CPU, but on | ||
| 1283 | * wake up the CPU we hibernated on might be offline as a side effect of | ||
| 1284 | * using maxcpus= for example. | ||
| 1285 | */ | ||
| 1286 | int bringup_hibernate_cpu(unsigned int sleep_cpu) | ||
| 1287 | { | ||
| 1288 | int ret; | ||
| 1289 | |||
| 1290 | if (!cpu_online(sleep_cpu)) { | ||
| 1291 | pr_info("Hibernated on a CPU that is offline! Bringing CPU up.\n"); | ||
| 1292 | ret = cpu_up(sleep_cpu); | ||
| 1293 | if (ret) { | ||
| 1294 | pr_err("Failed to bring hibernate-CPU up!\n"); | ||
| 1295 | return ret; | ||
| 1296 | } | ||
| 1297 | } | ||
| 1298 | return 0; | ||
| 1299 | } | ||
| 1300 | |||
| 1278 | #ifdef CONFIG_PM_SLEEP_SMP | 1301 | #ifdef CONFIG_PM_SLEEP_SMP |
| 1279 | static cpumask_var_t frozen_cpus; | 1302 | static cpumask_var_t frozen_cpus; |
| 1280 | 1303 | ||