• M
    arm64/fpsimd: Have KVM explicitly say which FP registers to save · deeb8f9a
    Mark Brown 提交于
    In order to avoid needlessly saving and restoring the guest registers KVM
    relies on the host FPSMID code to save the guest registers when we context
    switch away from the guest. This is done by binding the KVM guest state to
    the CPU on top of the task state that was originally there, then carefully
    managing the TIF_SVE flag for the task to cause the host to save the full
    SVE state when needed regardless of the needs of the host task. This works
    well enough but isn't terribly direct about what is going on and makes it
    much more complicated to try to optimise what we're doing with the SVE
    register state.
    
    Let's instead have KVM pass in the register state it wants saving when it
    binds to the CPU. We introduce a new FP_STATE_CURRENT for use
    during normal task binding to indicate that we should base our
    decisions on the current task. This should not be used when
    actually saving. Ideally we might want to use a separate enum for
    the type to save but this enum and the enum values would then
    need to be named which has problems with clarity and ambiguity.
    
    In order to ease any future debugging that might be required this patch
    does not actually update any of the decision making about what to save,
    it merely starts tracking the new information and warns if the requested
    state is not what we would otherwise have decided to save.
    Signed-off-by: NMark Brown <broonie@kernel.org>
    Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
    Reviewed-by: NMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20221115094640.112848-4-broonie@kernel.orgSigned-off-by: NWill Deacon <will@kernel.org>
    deeb8f9a
processor.h 11.5 KB