Lines Matching +full:suspend +full:- +full:to +full:- +full:idle
1 // SPDX-License-Identifier: GPL-2.0-only
31 static int tos_resident_cpu = -1;
42 * "enable-method" property of each CPU in the DT, but given that there is no
43 * arch-specific way to check this, we assume that the DT is sensible.
47 int migrate_type = -1; in psci_ops_check()
52 return -EOPNOTSUPP; in psci_ops_check()
66 if (tos_resident_cpu == -1) in psci_ops_check()
85 /* Try to power down all CPUs in the mask. */ in down_and_up_cpus()
94 if (ret != -EBUSY) { in down_and_up_cpus()
96 "to power down last online CPU %d\n", in down_and_up_cpus()
101 if (ret != -EPERM) { in down_and_up_cpus()
103 "to power down TOS resident CPU %d\n", in down_and_up_cpus()
109 "to power down CPU %d\n", ret, cpu); in down_and_up_cpus()
117 /* Try to power up all the CPUs that have been offlined. */ in down_and_up_cpus()
123 "to power up CPU %d\n", ret, cpu); in down_and_up_cpus()
156 return -ENOMEM; in alloc_init_cpu_groups()
162 return -ENOMEM; in alloc_init_cpu_groups()
174 return -ENOMEM; in alloc_init_cpu_groups()
188 int i, nb_cpu_group, err = -ENOMEM; in hotplug_tests()
206 pr_info("Trying to turn off and on again all CPUs\n"); in hotplug_tests()
217 page_buf[len - 1] = '\0'; in hotplug_tests()
218 pr_info("Trying to turn off and on again group %d (CPUs %s)\n", in hotplug_tests()
236 struct cpuidle_state *state = &drv->states[index]; in suspend_cpu()
237 bool broadcast = state->flags & CPUIDLE_FLAG_TIMER_STOP; in suspend_cpu()
244 * The local timer will be shut down, we need to enter tick in suspend_cpu()
251 * this CPU might be used to broadcast wakeups, which in suspend_cpu()
253 * There is little the kernel can do to work around in suspend_cpu()
254 * that, so enter WFI instead (idle state 0). in suspend_cpu()
262 ret = state->enter(dev, drv, index); in suspend_cpu()
279 /* No need for an actual callback, we just want to wake up the CPU. */ in suspend_test_thread()
282 /* Wait for the main thread to give the start signal. */ in suspend_test_thread()
285 /* Set maximum priority to preempt all other threads on this CPU. */ in suspend_test_thread()
291 pr_info("CPU %d entering suspend cycles, states 1 through %d\n", in suspend_test_thread()
292 cpu, drv->state_count - 1); in suspend_test_thread()
301 for (index = 1; index < drv->state_count; ++index) { in suspend_test_thread()
303 struct cpuidle_state *state = &drv->states[index]; in suspend_test_thread()
306 * Set the timer to wake this CPU up in some time (which in suspend_test_thread()
307 * should be largely sufficient for entering suspend). in suspend_test_thread()
308 * If the local tick is disabled when entering suspend, in suspend_test_thread()
309 * suspend_cpu() takes care of switching to a broadcast in suspend_test_thread()
313 usecs_to_jiffies(state->target_residency)); in suspend_test_thread()
315 /* IRQs must be disabled during suspend operations. */ in suspend_test_thread()
321 * We have woken up. Re-enable IRQs to handle any in suspend_test_thread()
333 pr_err("Failed to suspend CPU %d: error %d " in suspend_test_thread()
342 * Disable the timer to make sure that the timer will not trigger in suspend_test_thread()
352 /* Needs to be set first to avoid missing a wakeup. */ in suspend_test_thread()
359 pr_info("CPU %d suspend test results: success %d, shallow states %d, errors %d\n", in suspend_test_thread()
376 return -ENOMEM; in suspend_tests()
379 * Stop cpuidle to prevent the idle tasks from entering a deep sleep in suspend_tests()
380 * mode, as it might interfere with the suspend threads on other CPUs. in suspend_tests()
381 * This does not prevent the suspend threads from using cpuidle (only in suspend_tests()
382 * the idle tasks check this status). Take the idle lock so that in suspend_tests()
383 * the cpuidle driver and device look-up can be carried out safely. in suspend_tests()
403 pr_err("Failed to create kthread on CPU %d\n", cpu); in suspend_tests()
409 err = -ENODEV; in suspend_tests()
416 * Wake up the suspend threads. To avoid the main thread being preempted in suspend_tests()
417 * before all the threads have been unparked, the suspend threads will in suspend_tests()
471 pr_info("Starting suspend tests (%d cycles per state)\n", in psci_checker()
475 pr_info("Suspend tests passed OK\n"); in psci_checker()
477 pr_err("%d error(s) encountered in suspend tests\n", ret); in psci_checker()
480 case -ENOMEM: in psci_checker()
483 case -ENODEV: in psci_checker()
484 pr_warn("Could not start suspend tests on any CPU\n"); in psci_checker()