[PATCH v2 29/39] KVM: arm64: gic-v5: Support SPI injection

Vladimir Murzin vladimir.murzin at arm.com
Tue May 26 06:41:33 PDT 2026


Hi Sascha,

On 5/21/26 15:59, Sascha Bischoff wrote:
>  	/* SPIs */
> -	if (intid >= VGIC_NR_PRIVATE_IRQS &&
> -	    intid < (kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS)) {
> -		intid = array_index_nospec(intid, kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS);
> -		return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS];
> +	if (__irq_is_spi(type, intid)) {
> +		switch (type) {
> +		case KVM_DEV_TYPE_ARM_VGIC_V5:
> +			intid = vgic_v5_get_hwirq_id(intid);
> +
> +			if (intid >= kvm->arch.vgic.nr_spis)
> +				return NULL;
> +
> +			intid = array_index_nospec(intid, kvm->arch.vgic.nr_spis);
> +			return &kvm->arch.vgic.spis[intid];
> +		default:
> +			u32 max_intid = kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS;
> +
> +			if (intid < max_intid) {
> +				intid = array_index_nospec(intid, max_intid);
> +				return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS];
> +			}
> +		}
>  	}

Just quick update to save everybody's time. That hunk causes my build fail with:

arch/arm64/kvm/vgic/vgic.c: In function 'vgic_get_irq':
arch/arm64/kvm/vgic/vgic.c:103:4: error: a label can only be part of a statement and a declaration is not a statement
  103 |    u32 max_intid = kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS;
      |    ^~~
make[4]: *** [scripts/Makefile.build:289: arch/arm64/kvm/vgic/vgic.o] Error 1
make[3]: *** [scripts/Makefile.build:548: arch/arm64/kvm] Error 2
make[2]: *** [scripts/Makefile.build:548: arch/arm64] Error 2

Obvious fix-up would be wrap default case into curly braces.

Cheers
Vladimir




More information about the linux-arm-kernel mailing list