[PATCH] KVM: arm64: gic: Check for vGICv3 when clearing TWI

Marc Zyngier maz at kernel.org
Tue Jan 6 10:13:43 PST 2026


On Tue, 06 Jan 2026 16:52:10 +0000,
Sascha Bischoff <Sascha.Bischoff at arm.com> wrote:
> 
> Explicitly check for the vgic being v3 when disabling TWI. Failure to
> check this can result in using the wrong view of the vgic CPU IF union
> causing undesirable/unexpected behaviour.
> 
> Signed-off-by: Sascha Bischoff <sascha.bischoff at arm.com>
> ---
>  arch/arm64/kvm/arm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 4f80da0c0d1de..620a465248d1b 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -569,6 +569,7 @@ static bool kvm_vcpu_should_clear_twi(struct kvm_vcpu *vcpu)
>  		return kvm_wfi_trap_policy == KVM_WFX_NOTRAP;
>  
>  	return single_task_running() &&
> +	       vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3 &&
>  	       (atomic_read(&vcpu->arch.vgic_cpu.vgic_v3.its_vpe.vlpi_count) ||
>  		vcpu->kvm->arch.vgic.nassgireq);
>  }

Nice one. Wonder how many other similar cases we have... :-/

Reviewed-by: Marc Zyngier <maz at kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list