This commit can likely be dropped if we apply the approach from the
review of the previous one (i.e. do not introduce per-domain GIC_V4/V4_1
versions in the domctl ABI and keep guests on XEN_DOMCTL_CONFIG_GIC_V3).

In that case current->domain->arch.vgic.version would remain GIC_V3 for
v4-capable systems too, so the existing checks (== GIC_V3) already cover
the intended behaviour.

If we keep v4/v4.1 as distinct internal values, then using >= GIC_V3 is
fine, but please avoid relying on numeric ordering of enums unless that
ordering is explicitly guaranteed.


Thanks,
Mykola

On Mon, Feb 2, 2026 at 6:14 PM Mykyta Poturai <[email protected]> wrote:
>
> Extend the check to mark interrupts as Group1 for all GIC versions >= 3
>
> Signed-off-by: Mykyta Poturai <[email protected]>
> ---
>  xen/arch/arm/gic-v3.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 07736179db..1cb3169b72 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -1366,10 +1366,10 @@ static void gicv3_update_lr(int lr, unsigned int 
> virq, uint8_t priority,
>      val =  (((uint64_t)state & 0x3) << ICH_LR_STATE_SHIFT);
>
>      /*
> -     * When the guest is GICv3, all guest IRQs are Group 1, as Group0
> -     * would result in a FIQ in the guest, which it wouldn't expect
> +     * When the guest is GICv3/GICv4/GICv4.1, all guest IRQs are Group 1, as
> +     * Group0 would result in a FIQ in the guest, which it wouldn't expect
>       */
> -    if ( current->domain->arch.vgic.version == GIC_V3 )
> +    if ( current->domain->arch.vgic.version >= GIC_V3 )
>          val |= ICH_LR_GRP1;
>
>      val |= (uint64_t)priority << ICH_LR_PRIORITY_SHIFT;
> @@ -1455,10 +1455,10 @@ static void gicv3_write_lr(int lr, const struct 
> gic_lr *lr_reg)
>      }
>
>      /*
> -     * When the guest is using vGICv3, all the IRQs are Group 1. Group 0
> -     * would result in a FIQ, which will not be expected by the guest OS.
> +     * When the guest is using vGICv3/vGICv4/vGICv4.1, all the IRQs are 
> Group 1.
> +     * Group 0 would result in a FIQ, which will not be expected by the 
> guest OS.
>       */
> -    if ( vgic_version == GIC_V3 )
> +    if ( vgic_version >= GIC_V3 )
>          lrv |= ICH_LR_GRP1;
>
>      gicv3_ich_write_lr(lr, lrv);
> --
> 2.51.2

Reply via email to