• Marc Zyngier's avatar
    KVM: arm64: nv: Fast-track 'InHost' exception returns · dd0717a9
    Marc Zyngier authored
    A significant part of the FEAT_NV extension is to trap ERET
    instructions so that the hypervisor gets a chance to switch
    from a vEL2 L1 guest to an EL1 L2 guest.
    
    But this also has the unfortunate consequence of trapping ERET
    in unsuspecting circumstances, such as staying at vEL2 (interrupt
    handling while being in the guest hypervisor), or returning to host
    userspace in the case of a VHE guest.
    
    Although we already make some effort to handle these ERET quicker
    by not doing the put/load dance, it is still way too far down the
    line for it to be efficient enough.
    
    For these cases, it would ideal to ERET directly, no question asked.
    Of course, we can't do that. But the next best thing is to do it as
    early as possible, in fixup_guest_exit(), much as we would handle
    FPSIMD exceptions.
    Reviewed-by: default avatarJoey Gouly <joey.gouly@arm.com>
    Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
    Link: https://lore.kernel.org/r/20240419102935.1935571-8-maz@kernel.orgSigned-off-by: default avatarMarc Zyngier <maz@kernel.org>
    dd0717a9
switch.c 10.4 KB