1 // © 2021 Qualcomm Innovation Center, Inc. All rights reserved. 2 // 3 // SPDX-License-Identifier: BSD-3-Clause 4 5 // Execute the architecture's basic wait-for-interrupt instruction. 6 // 7 // This function is called with interrupts disabled. 8 // 9 // If interrupts must be enabled for the wait instruction to function correctly, 10 // this function may enable them; in this case the architecture's vectors must 11 // be able to handle interrupts taken from the idle loop, even in non- 12 // preemptible configurations that otherwise do not take interrupts in the 13 // hypervisor. Interrupts must be disabled again before returning. 14 // 15 // If the wait instruction can work with interrupts disabled, this function 16 // must leave them disabled and call irq_interrupt_dispatch() directly after the 17 // wait. This call may be conditional on an explicit check for pending 18 // interrupts, if such a check is possible. 19 // 20 // This function returns true if a reschedule may be necessary. An 21 // implementation that enables interrupts must always return true. 22 bool 23 idle_arch_wait(void) REQUIRE_PREEMPT_DISABLED; 24 25 // Execute a wait-for-interrupt with a timeout. 26 // 27 // This is the same as idle_arch_wait(), except that a timeout can be specified 28 // (as an absolute ticks value) as the time at which the CPU will stop waiting. 29 // If possible, the implementation should execute a wait for interrupt 30 // instruction, and arrange to be woken at expiry of the timeout if no other 31 // event has occurred. 32 // 33 // The wokeup mechanism should not rely on interrupt delivery, and should not 34 // execute any non-trivial code; it is assumed that an architectural wakeup 35 // mechanism will be used (e.g. AArch64 FEAT_WFxT). If no such mechanism is 36 // available, the implementation should check for interrupts without waiting. 37 bool 38 idle_arch_wait_timeout(ticks_t timeout) REQUIRE_PREEMPT_DISABLED; 39