[PATCH v1 1/4] KVM: arm64: Don't WARN on an unsupported TLBI OS from vEL1

Wei-Lin Chang weilin.chang at arm.com
Fri Sep 25 09:33:47 PDT 2026


On Fri, Sep 25, 2026 at 10:06:16AM +0100, Fuad Tabba wrote:
> A VMM can trigger the WARN_ON(!vcpu_is_el2()) in handle_tlbi_el1() on a
> CPU with FEAT_EVT2 and FEAT_TLBIOS but no FEAT_FGT, by setting
> ID_AA64ISAR0_EL1.TLB to NI and having the guest execute TLBI VMALLE1OS.
> 
> Without FGT, HCR_EL2.TTLBOS traps the instruction. KVM records no FGT
> trap information on such a host, so triage_sysreg_trap() doesn't UNDEF
> it. The instruction reaches handle_tlbi_el1(), which warns before
> checking whether the guest supports it.
> 
> Check support before the warning.
> 
> Fixes: 0cb8aae226768 ("KVM: arm64: nv: Add handling of outer-shareable TLBI operations")
> Cc: stable at vger.kernel.org
> Signed-off-by: Fuad Tabba <fuad.tabba at linux.dev>

Looks correct to me:

Reviewed-by: Wei-Lin Chang <weilin.chang at arm.com>

> ---
>  arch/arm64/kvm/sys_regs.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 44aae52c473d7..0ce29ce678b08 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -4257,6 +4257,10 @@ static bool handle_tlbi_el1(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
>  {
>  	u32 sys_encoding = sys_insn(p->Op0, p->Op1, p->CRn, p->CRm, p->Op2);
>  
> +	/* Without FGT, HCR_EL2.TTLBOS also traps a hidden TLBI OS from vEL1 */
> +	if (!kvm_supported_tlbi_s1e1_op(vcpu, sys_encoding))
> +		return undef_access(vcpu, p, r);
> +
>  	/*
>  	 * If we're here, this is because we've trapped on a EL1 TLBI
>  	 * instruction that affects the EL1 translation regime while
> @@ -4279,9 +4283,6 @@ static bool handle_tlbi_el1(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
>  
>  	WARN_ON(!vcpu_is_el2(vcpu));
>  
> -	if (!kvm_supported_tlbi_s1e1_op(vcpu, sys_encoding))
> -		return undef_access(vcpu, p, r);
> -
>  	if (vcpu_el2_e2h_is_set(vcpu) && vcpu_el2_tge_is_set(vcpu)) {
>  		kvm_handle_s1e2_tlbi(vcpu, sys_encoding, p->regval);
>  		return true;
> -- 
> 2.39.5
> 



More information about the linux-arm-kernel mailing list