• Rafael J. Wysocki's avatar
    ACPI: PM: s2idle: Execute LPS0 _DSM functions with suspended devices · ac9eafbe
    Rafael J. Wysocki authored
    According to Section 3.5 of the "Intel Low Power S0 Idle" document [1],
    Function 5 of the LPS0 _DSM is expected to be invoked when the system
    configuration matches the criteria for entering the target low-power
    state of the platform.  In particular, this means that all devices
    should be suspended and in low-power states already when that function
    is invoked.
    
    This is not the case currently, however, because Function 5 of the
    LPS0 _DSM is invoked by it before the "noirq" phase of device suspend,
    which means that some devices may not have been put into low-power
    states yet at that point.  That is a consequence of the previous
    design of the suspend-to-idle flow that allowed the "noirq" phase of
    device suspend and the "noirq" phase of device resume to be carried
    out for multiple times while "suspended" (if any spurious wakeup
    events were detected) and the point of the LPS0 _DSM Function 5
    invocation was chosen so as to call it (and LPS0 _DSM Function 6
    analogously) once per suspend-resume cycle (regardless of how many
    times the "noirq" phases of device suspend and resume were carried
    out while "suspended").
    
    Now that the suspend-to-idle flow has been redesigned to carry out
    the "noirq" phases of device suspend and resume once in each cycle,
    the code can be reordered to follow the specification that it is
    based on more closely.
    
    For this purpose, add ->prepare_late and ->restore_early platform
    callbacks for suspend-to-idle, to be executed, respectively, after
    the "noirq" phase of suspending devices and before the "noirq"
    phase of resuming them and make ACPI use them for the invocation
    of LPS0 _DSM functions as appropriate.
    
    While at it, move the LPS0 entry requirements check to be made
    before invoking Functions 3 and 5 of the LPS0 _DSM (also once
    per cycle) as follows from the specification [1].
    
    Link: https://uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf # [1]
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
    ac9eafbe
sleep.c 31.9 KB