|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen/arm: vgic: ignore SGI bits in GICv2 pending-register writes
On 04-Dec-26 01:16, Mykola Kvach wrote:
> GICv2 tracks pending SGIs per sender. Arm IHI 0048B.b sections 4.3.7
> and 4.3.8 (see also section 2.3.8) specify that writes to the SGI bits
> in GICD_ISPENDR0 and GICD_ICPENDR0 are ignored.
>
> Updating irq->pending_latch there leaves it inconsistent with the SGI
> source mask: setting an SGI bit in GICD_ISPENDR0 queues the SGI with
> irq->source == 0, triggering BUG_ON(!src) in vgic_v2_populate_lr() and
> crashing the hypervisor, while clearing an SGI bit in GICD_ICPENDR0
> drops pending_latch while leaving irq->source non-zero.
>
> Mask the SGI bits of the first register before updating pending state.
> PPI bits in the same access and SPI accesses retain their behaviour.
>
> Fixes: 4feaf88d32b8 ("ARM: new VGIC: Add PENDING registers handlers")
> Assisted-by: Codex:gpt-6.2-astra
> Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
> ---
> xen/arch/arm/vgic/vgic-mmio.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c
> index d2bcb32cd7..86658a5e77 100644
> --- a/xen/arch/arm/vgic/vgic-mmio.c
> +++ b/xen/arch/arm/vgic/vgic-mmio.c
> @@ -185,6 +185,13 @@ void vgic_mmio_write_spending(struct vcpu *vcpu,
> unsigned long flags;
> irq_desc_t *desc;
>
> + /*
> + * In GICv2, writes to SGI bits in GICD_ISPENDR0 are ignored (Arm IHI
> + * 0048B.b, 4.3.7); use GICD_SGIR or GICD_SPENDSGIRn instead.
Here and ...
> + */
> + if ( !intid && vcpu->domain->arch.vgic.version == GIC_V2 )
> + val &= ~GENMASK(VGIC_NR_SGIS - 1, 0);
> +
> for_each_set_bit ( i, val )
> {
> struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
> @@ -232,6 +239,13 @@ void vgic_mmio_write_cpending(struct vcpu *vcpu,
> unsigned long flags;
> irq_desc_t *desc;
>
> + /*
> + * In GICv2, writes to SGI bits in GICD_ICPENDR0 are ignored (Arm IHI
> + * 0048B.b, 4.3.8); use GICD_CPENDSGIRn instead.
... here: "use XXX instead" is advice to the guest, not something that helps
reading the emulation code. These parts can be dropped on commit, so:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
~Michal
> + */
> + if ( !intid && vcpu->domain->arch.vgic.version == GIC_V2 )
> + val &= ~GENMASK(VGIC_NR_SGIS - 1, 0);
> +
> for_each_set_bit ( i, val )
> {
> struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |