• David Brazdil's avatar
    KVM: arm64: Intercept host's CPU_SUSPEND PSCI SMCs · abf16336
    David Brazdil authored
    Add a handler of CPU_SUSPEND host PSCI SMCs. The SMC can either enter
    a sleep state indistinguishable from a WFI or a deeper sleep state that
    behaves like a CPU_OFF+CPU_ON except that the core is still considered
    online while asleep.
    
    The handler saves r0,pc of the host and makes the same call to EL3 with
    the hyp CPU entry point. It either returns back to the handler and then
    back to the host, or wakes up into the entry point and initializes EL2
    state before dropping back to EL1. No EL2 state needs to be
    saved/restored for this purpose.
    
    CPU_ON and CPU_SUSPEND are both implemented using struct psci_boot_args
    to store the state upon powerup, with each CPU having separate structs
    for CPU_ON and CPU_SUSPEND so that CPU_SUSPEND can operate locklessly
    and so that a CPU_ON call targeting a CPU cannot interfere with
    a concurrent CPU_SUSPEND call on that CPU.
    Signed-off-by: default avatarDavid Brazdil <dbrazdil@google.com>
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20201202184122.26046-23-dbrazdil@google.com
    abf16336
psci-relay.c 7.88 KB