[PATCH v5 07/36] KVM: arm64: gic: Introduce interrupt type helpers
Sascha Bischoff
Sascha.Bischoff at arm.com
Tue Mar 3 09:21:46 PST 2026
On Tue, 2026-03-03 at 15:04 +0000, Marc Zyngier wrote:
> On Thu, 26 Feb 2026 15:57:14 +0000,
> Sascha Bischoff <Sascha.Bischoff at arm.com> wrote:
> >
> > GICv5 has moved from using interrupt ranges for different interrupt
> > types to using some of the upper bits of the interrupt ID to denote
> > the interrupt type. This is not compatible with older GICs (which
> > rely
> > on ranges of interrupts to determine the type), and hence a set of
> > helpers is introduced. These helpers take a struct kvm*, and use
> > the
> > vgic model to determine how to interpret the interrupt ID.
> >
> > Helpers are introduced for PPIs, SPIs, and LPIs. Additionally, a
> > helper is introduced to determine if an interrupt is private - SGIs
> > and PPIs for older GICs, and PPIs only for GICv5.
> >
> > The helpers are plumbed into the core vgic code, as well as the
> > Arch
> > Timer and PMU code.
> >
> > There should be no functional changes as part of this change.
> >
> > Signed-off-by: Sascha Bischoff <sascha.bischoff at arm.com>
> > Reviewed-by: Joey Gouly <joey.gouly at arm.com>
> > Reviewed-by: Jonathan Cameron <jonathan.cameron at huawei.com>
> > ---
> > arch/arm64/kvm/arch_timer.c | 2 +-
> > arch/arm64/kvm/pmu-emul.c | 7 +-
> > arch/arm64/kvm/vgic/vgic-kvm-device.c | 2 +-
> > arch/arm64/kvm/vgic/vgic.c | 14 ++--
> > include/kvm/arm_vgic.h | 92
> > +++++++++++++++++++++++++--
> > 5 files changed, 100 insertions(+), 17 deletions(-)
> >
>
> [...]
>
> > diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
> > index f2eafc65bbf4c..f12b47e589abc 100644
> > --- a/include/kvm/arm_vgic.h
> > +++ b/include/kvm/arm_vgic.h
>
> [...]
>
> > +#define vgic_is_v5(k) ((k)->arch.vgic.vgic_model ==
> > KVM_DEV_TYPE_ARM_VGIC_V5)
>
> vgic_is_v3() is defined in arch/arm64/kvm/vgic/vgic.h, as a function
> rather than a macro. These things should all live together, and
> preferably have similar implementation styles.
Hi Marc,
That's a good shout. I've moved the vgic_is_v3() to the arm_vgic.h
header (it is included in more places, and makes the helpers more
useful than in in vgic.h). Moreover, I've made it a macro:
+#define __vgic_is_v(k, v) ((k)->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V##v)
+#define vgic_is_v3(k) (__vgic_is_v(k, 3))
+#define vgic_is_v5(k) (__vgic_is_v(k, 5))
Thanks,
Sascha
>
> Thanks,
>
> M.
>
More information about the linux-arm-kernel
mailing list