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

From: Sascha Bischoff <[email-masked]>
Date: Thu, 28 May 2026 14:59:01 +0000

On Tue, 2026-05-26 at 14:41 +0100, Vladimir Murzin wrote:
> 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

Hi Vladimir,

Thanks for catching that - it seems that my toolchain was too modern,
and that GCC<=10.5.0 hits this. I'll make a point of building with some
older toolchains henceforth.

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

That's what I've gone and done.

Thanks a lot,
Sascha

> Cheers
> Vladimir