arm64: use WFE for long delays
authorJulien Thierry <julien.thierry@arm.com>
Fri, 13 Oct 2017 13:32:56 +0000 (14:32 +0100)
committerWill Deacon <will.deacon@arm.com>
Fri, 13 Oct 2017 17:56:15 +0000 (18:56 +0100)
commit7b77452ec524fa845efdec28ae16e2202cf797dc
treefa5da4cbe17b85d94be06f1e704eff52fe88f1f9
parentec5c8e429d07737ee94ee1fd2ae5029547484194
arm64: use WFE for long delays

The current delay implementation uses the yield instruction, which is a
hint that it is beneficial to schedule another thread. As this is a hint,
it may be implemented as a NOP, causing all delays to be busy loops. This
is the case for many existing CPUs.

Taking advantage of the generic timer sending periodic events to all
cores, we can use WFE during delays to reduce power consumption. This is
beneficial only for delays longer than the period of the timer event
stream.

If timer event stream is not enabled, delays will behave as yield/busy
loops.

Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/lib/delay.c
include/clocksource/arm_arch_timer.h