• Johannes Berg's avatar
    um: Support suspend to RAM · a374b7cb
    Johannes Berg authored
    With all the previous bits in place, we can now also support
    suspend to RAM, in the sense that everything is suspended,
    not just most, including userspace, processes like in s2idle.
    
    Since um_idle_sleep() now waits forever, we can simply call
    that to "suspend" the system.
    
    As before, you can wake it up using SIGUSR1 since we're just
    in a pause() call that only needs to return.
    
    In order to implement selective resume from certain devices,
    and not have any arbitrary device interrupt wake up, suspend
    interrupts by removing SIGIO notification (O_ASYNC) from all
    the FDs that are not supposed to wake up the system. However,
    swap out the handler so we don't actually handle the SIGIO as
    an interrupt.
    
    Since we're in pause(), the mere act of receiving SIGIO wakes
    us up, and then after things have been restored enough, re-set
    O_ASYNC for all previously suspended FDs, reinstall the proper
    SIGIO handler, and send SIGIO to self to process anything that
    might now be pending.
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
    a374b7cb
os.h 11.2 KB