[RFC PATCH 2/7] arm64: kernel: Add a WFI hook.

Hector Martin 'marcan' marcan at marcan.st
Thu Jan 21 07:33:46 EST 2021


I already mentioned this privately, but for the benefit of the ML:

On 21/01/2021 09.48, Mohamed Mediouni wrote:
> If we explicitly use the hardware override registers for this, then
> we'll be unable to use the deep sleep support provided by wfi on
> Apple SoCs later on without touching Apple-specific MSRs.
> 
> Our current policy is to avoid having those modified inside the kernel
> at all costs, considering it to be a job for the bootloader instead.

I don't think there is any particular reason to do this; the bootloader 
should be responsible for setting up all the chicken bits that make the 
CPU work properly, including doing so for all SMP cores before entering 
the kernel, but that's not the same thing as power management bits.

It seems entirely reasonable to me to configure WFI as clockgate only 
(so it keeps state), not touch this part of kernel code at all, and then 
in the cpuidle driver (which can come later) just do:

- switch to powerdown mode
- save state
- wfi
- restore state
- switch to clockgate mode

-- 
Hector Martin "marcan" (marcan at marcan.st)
Public Key: https://mrcn.st/pub



More information about the linux-arm-kernel mailing list