On Wed, May 29, 2024 at 01:12:09PM +0100, Pierre-Clément Tosi wrote: > In invalid_host_el2_vect (i.e. EL2{t,h} handlers in nVHE guest context), *guest* context? Are you sure? > remove the duplicate vCPU context check that __guest_exit_panic also > performs, allowing an unconditional branch to it. > > Signed-off-by: Pierre-Clément Tosi <ptosi@xxxxxxxxxx> > --- > arch/arm64/kvm/hyp/nvhe/host.S | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S > index 135cfb294ee5..71fb311b4c0e 100644 > --- a/arch/arm64/kvm/hyp/nvhe/host.S > +++ b/arch/arm64/kvm/hyp/nvhe/host.S > @@ -197,18 +197,13 @@ SYM_FUNC_END(__host_hvc) > sub x0, sp, x0 // x0'' = sp' - x0' = (sp + x0) - sp = x0 > sub sp, sp, x0 // sp'' = sp' - x0 = (sp + x0) - x0 = sp > > - /* If a guest is loaded, panic out of it. */ > - stp x0, x1, [sp, #-16]! > - get_loaded_vcpu x0, x1 > - cbnz x0, __guest_exit_panic > - add sp, sp, #16 I think this is actually dead code and we should just remove it. AFAICT, invalid_host_el2_vect is only used for the host vectors and the loaded vCPU will always be NULL, so this is pointless. set_loaded_vcpu() is only called by the low-level guest entry/exit code and with the guest EL2 vectors installed. > - > /* > * The panic may not be clean if the exception is taken before the host > * context has been saved by __host_exit or after the hyp context has > * been partially clobbered by __host_enter. > */ > - b hyp_panic > + stp x0, x1, [sp, #-16]! > + b __guest_exit_panic In which case, this should just be: add sp, sp, #16 b hyp_panic Did I miss something? Will