• Mark Brown's avatar
    KVM: arm64: Handle SME host state when running guests · 861262ab
    Mark Brown authored
    While we don't currently support SME in guests we do currently support it
    for the host system so we need to take care of SME's impact, including
    the floating point register state, when running guests. Simiarly to SVE
    we need to manage the traps in CPACR_RL1, what is new is the handling of
    streaming mode and ZA.
    
    Normally we defer any handling of the floating point register state until
    the guest first uses it however if the system is in streaming mode FPSIMD
    and SVE operations may generate SME traps which we would need to distinguish
    from actual attempts by the guest to use SME. Rather than do this for the
    time being if we are in streaming mode when entering the guest we force
    the floating point state to be saved immediately and exit streaming mode,
    meaning that the guest won't generate SME traps for supported operations.
    
    We could handle ZA in the access trap similarly to the FPSIMD/SVE state
    without the disruption caused by streaming mode but for simplicity
    handle it the same way as streaming mode for now.
    
    This will be revisited when we support SME for guests (hopefully before SME
    hardware becomes available), for now it will only incur additional cost on
    systems with SME and even there only if streaming mode or ZA are enabled.
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Reviewed-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20220419112247.711548-27-broonie@kernel.orgSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    861262ab
kvm_host.h 26.3 KB