• Fenghua Yu's avatar
    x86/xsaves: Add xsaves and xrstors support for booting time · adb9d526
    Fenghua Yu authored
    Since boot_cpu_data and cpu capabilities are not enabled yet during early
    booting time, alternative can not be used in some functions to access xsave
    area. Therefore, we define two new functions xrstor_state_booting() and
    xsave_state_booting() to access xsave area just during early booting time.
    
    xrstor_state_booting restores xstate from xsave area during early booting time.
    xsave_state_booting saves xstate to xsave area during early booting time.
    
    The two functions are similar to xrstor_state and xsave_state respectively.
    But the two functions don't use alternatives because alternatives are not
    enabled when they are called in such early booting time.
    
    xrstor_state_booting is called only by functions defined as __init. So it's
    defined as __init and will be removed from memory after booting time. There
    is no extra memory cost caused by this function during running time.
    
    But because xsave_state_booting can be called by run-time function __save_fpu(),
    it's not defined as __init and will stay in memory during running time although
    it will not be called anymore during running time. It is not ideal to
    have this function stay in memory during running time. But it's a pretty small
    function and the memory cost will be small. By doing in this way, we can
    avoid to change a lot of code to just remove this small function and save a
    bit memory for running time.
    Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
    Link: http://lkml.kernel.org/r/1401387164-43416-13-git-send-email-fenghua.yu@intel.comSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    adb9d526
xsave.h 6.08 KB