• Thomas Gleixner's avatar
    x86/fpu/xsave: Support XSAVEC in the kernel · 8ad7e8f6
    Thomas Gleixner authored
    XSAVEC is the user space counterpart of XSAVES which cannot save supervisor
    state. In virtualization scenarios the hypervisor does not expose XSAVES
    but XSAVEC to the guest, though the kernel does not make use of it.
    
    That's unfortunate because XSAVEC uses the compacted format of saving the
    XSTATE. This is more efficient in terms of storage space vs. XSAVE[OPT] as
    it does not create holes for XSTATE components which are not supported or
    enabled by the kernel but are available in hardware. There is room for
    further optimizations when XSAVEC/S and XGETBV1 are supported.
    
    In order to support XSAVEC:
    
     - Define the XSAVEC ASM macro as it's not yet supported by the required
       minimal toolchain.
    
     - Create a software defined X86_FEATURE_XCOMPACTED to select the compacted
       XSTATE buffer format for both XSAVEC and XSAVES.
    
     - Make XSAVEC an option in the 'XSAVE' ASM alternatives
    Requested-by: default avatarAndrew Cooper <Andrew.Cooper3@citrix.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20220404104820.598704095@linutronix.de
    8ad7e8f6
xstate.h 9.06 KB