• Thomas Gleixner's avatar
    x86/fpu: Provide struct fpstate · 87d0e5be
    Thomas Gleixner authored
    New xfeatures will not longer be automatically stored in the regular XSAVE
    buffer in thread_struct::fpu.
    
    The kernel will provide the default sized buffer for storing the regular
    features up to AVX512 in thread_struct::fpu and if a task requests to use
    one of the new features then the register storage has to be extended.
    
    The state will be accessed via a pointer in thread_struct::fpu which
    defaults to the builtin storage and can be switched when extended storage
    is required.
    
    To avoid conditionals all over the code, create a new container for the
    register storage which will gain other information, e.g. size, feature
    masks etc., later. For now it just contains the register storage, which
    gives it exactly the same layout as the exiting fpu::state.
    
    Stick fpu::state and the new fpu::__fpstate into an anonymous union and
    initialize the pointer. Add build time checks to validate that both are
    at the same place and have the same size.
    
    This allows step by step conversion of all users.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Link: https://lkml.kernel.org/r/20211013145322.234458659@linutronix.de
    87d0e5be
init.c 5.89 KB