All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zenghui Yu <zenghui.yu@linux.dev>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	Jonathan Cameron <jonathan.cameron@huawei.com>
Subject: Re: [PATCH v2 24/65] hw/intc/arm_gicv5: Make gicv5_set_* update SPI state
Date: Thu, 26 Nov 2026 13:10:56 +0800	[thread overview]
Message-ID: <079c7160-0374-4cc9-bc76-ba5f7f216ecb@linux.dev> (raw)
In-Reply-To: <20260327111700.795099-25-peter.maydell@linaro.org>

On 3/27/26 7:16 PM, Peter Maydell wrote:
> The GIC CD* insns that update interrupt state also work for SPIs.
> Instead of ignoring the GICV5_SPI type in gicv5_set_priority() and
> friends, update the state in our SPI state array.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/intc/arm_gicv5.c                | 64 ++++++++++++++++++++++++++++++
>  include/hw/intc/arm_gicv5_common.h | 40 +++++++++++++++++++
>  2 files changed, 104 insertions(+)
> 
> diff --git a/hw/intc/arm_gicv5.c b/hw/intc/arm_gicv5.c
> index d1eb96fce0..9ca1826253 100644
> --- a/hw/intc/arm_gicv5.c
> +++ b/hw/intc/arm_gicv5.c
> @@ -490,6 +490,19 @@ void gicv5_set_priority(GICv5Common *cs, uint32_t id, uint8_t priority,
>          put_l2_iste(cs, cfg, &h);
>          break;
>      }
> +    case GICV5_SPI:
> +    {
> +        GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
> +
> +        if (!spi) {
> +            qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_priority: tried to set "
> +                          "priority of unreachable SPI %d\n", id);
> +            return;
> +        }
> +
> +        spi->priority = priority;
> +        break;
> +    }
>      default:
>          qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_priority: tried to set "
>                        "priority of bad interrupt type %d\n", type);
> @@ -524,6 +537,19 @@ void gicv5_set_enabled(GICv5Common *cs, uint32_t id, bool enabled,
>          put_l2_iste(cs, cfg, &h);
>          break;
>      }
> +    case GICV5_SPI:
> +    {
> +        GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
> +
> +        if (!spi) {
> +            qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_enabled: tried to set "
> +                          "enable state of unreachable SPI %d\n", id);
> +            return;
> +        }
> +
> +        spi->enabled = true;

spi->enabled = enabled;	?

since gicv5_set_enabled() can be invoked by the GIC CDDIS emulation code.

> +        break;
> +    }
>      default:
>          qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_enabled: tried to set "
>                        "enable state of bad interrupt type %d\n", type);
> @@ -558,6 +584,19 @@ void gicv5_set_pending(GICv5Common *cs, uint32_t id, bool pending,
>          put_l2_iste(cs, cfg, &h);
>          break;
>      }
> +    case GICV5_SPI:
> +    {
> +        GICv5SPIState *spi = gicv5_spi_state(cs, id, domain);
> +
> +        if (!spi) {
> +            qemu_log_mask(LOG_GUEST_ERROR, "gicv5_set_pending: tried to set "
> +                          "pending state of unreachable SPI %d\n", id);
> +            return;
> +        }
> +
> +        spi->pending = true;

spi->pending = pending;	?

And having roughly read how we emulate the pending state... If the guest
has executed GIC CDPEND, which generates a SET event for a level-triggered
SPI, this SPI will keep pending until it is resampled (Ack doesn't clear
pending for it). I noticed it when I was playing the IRQ debugfs in a Linux
guest -

	echo -n trigger > /sys/kernel/debug/irq/irqs/<SPI>

resulted in an interrupt storm.

Could we take R_LKBBQ to ignore the SetPending in this case? Or resample
the SPI state appropriately (e.g., at Ack time)?

Thanks,
Zenghui


  parent reply	other threads:[~2026-11-26  5:11 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 11:15 [PATCH v2 00/65] arm: Implement an emulation of GICv5 interrupt controller Peter Maydell
2026-03-27 11:15 ` [PATCH v2 01/65] qom/object: Add object_resolve_and_typecheck() Peter Maydell
2026-03-27 11:15 ` [PATCH v2 02/65] hw/core: Permit devices to define an array of link properties Peter Maydell
2026-03-27 11:15 ` [PATCH v2 03/65] hw/intc: Skeleton of GICv5 IRS classes Peter Maydell
2026-04-13 23:13   ` Philippe Mathieu-Daudé
2026-03-27 11:15 ` [PATCH v2 04/65] hw/arm/Kconfig: select ARM_GICV5 for ARM_VIRT board Peter Maydell
2026-04-13 23:13   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 05/65] hw/intc/arm_gicv5: Implement skeleton code for IRS register frames Peter Maydell
2026-03-27 11:16 ` [PATCH v2 06/65] hw/intc/arm_gicv5: Add migration blocker Peter Maydell
2026-03-27 11:16 ` [PATCH v2 07/65] hw/intc/arm_gicv5: Create and validate QOM properties Peter Maydell
2026-04-14 11:53   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 08/65] hw/intc/arm_gicv5: Create inbound GPIO lines for SPIs Peter Maydell
2026-04-14 11:53   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 09/65] hw/intc/arm_gicv5: Define macros for config frame registers Peter Maydell
2026-03-27 11:16 ` [PATCH v2 10/65] hw/intc/arm_gicv5: Implement IRS ID regs Peter Maydell
2026-04-10 15:04   ` Peter Maydell
2026-04-30 14:50     ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 11/65] hw/intc/arm_gicv5: Add link property for MemoryRegion for DMA Peter Maydell
2026-04-13 23:10   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 12/65] hw/intc/arm_gicv5: Implement gicv5_class_name() Peter Maydell
2026-04-13 23:10   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 13/65] hw/intc/arm_gicv5: Add defines for GICv5 architected PPIs Peter Maydell
2026-04-13 23:09   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 14/65] target/arm: GICv5 cpuif: Initial skeleton and GSB barrier insns Peter Maydell
2026-03-27 11:16 ` [PATCH v2 15/65] target/arm: Set up pointer to GICv5 in each CPU Peter Maydell
2026-04-13 23:08   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 16/65] hw/intc/arm_gicv5: Implement IRS_IST_{BASER, STATUSR, CFGR} Peter Maydell
2026-03-27 11:16 ` [PATCH v2 17/65] hw/intc/arm_gicv5: Cache LPI IST config in a struct Peter Maydell
2026-03-27 11:16 ` [PATCH v2 18/65] hw/intc/arm_gicv5: Implement gicv5_set_priority() Peter Maydell
2026-03-27 11:16 ` [PATCH v2 19/65] target/arm: GICv5 cpuif: Implement the GIC CDPRI instruction Peter Maydell
2026-03-27 11:16 ` [PATCH v2 20/65] hw/intc/arm_gicv5: Implement IRS_MAP_L2_ISTR Peter Maydell
2026-03-27 11:16 ` [PATCH v2 21/65] hw/intc/arm_gicv5: Implement remaining set-config functions Peter Maydell
2026-03-27 11:16 ` [PATCH v2 22/65] target/arm: GICv5 cpuif: Implement GIC CD* insns for setting config Peter Maydell
2026-03-27 11:16 ` [PATCH v2 23/65] hw/intc/arm_gicv5: Create backing state for SPIs Peter Maydell
2026-03-27 11:16 ` [PATCH v2 24/65] hw/intc/arm_gicv5: Make gicv5_set_* update SPI state Peter Maydell
2026-04-13 22:51   ` Philippe Mathieu-Daudé
2026-11-26  5:10   ` Zenghui Yu [this message]
2026-03-27 11:16 ` [PATCH v2 25/65] hw/intc/arm_gicv5: Implement gicv5_request_config() Peter Maydell
2026-04-30 15:34   ` Philippe Mathieu-Daudé
2026-05-05 15:36     ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 26/65] target/arm: GICv5 cpuif: Implement GIC CDRCFG and ICC_ICSR_EL1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 27/65] hw/intc/arm_gicv5: Implement IRS_SPI_{SELR, STATUSR, CFGR, DOMAINR} Peter Maydell
2026-03-27 11:16 ` [PATCH v2 28/65] hw/intc/arm_gicv5: Update SPI state for CLEAR/SET events Peter Maydell
2026-03-27 11:16 ` [PATCH v2 29/65] hw/intc/arm_gicv5: Implement IRS_CR0 and IRS_CR1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 30/65] hw/intc/arm_gicv5: Implement IRS_SYNCR and IRS_SYNC_STATUSR Peter Maydell
2026-03-27 11:16 ` [PATCH v2 31/65] hw/intc/arm_gicv5: Implement IRS_PE_{CR0, SELR, STATUSR} Peter Maydell
2026-03-27 11:16 ` [PATCH v2 32/65] hw/intc/arm_gicv5: Implement CoreSight ID registers Peter Maydell
2026-04-30 14:26   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 33/65] hw/intc/arm_gicv5: Cache pending LPIs in a hash table Peter Maydell
2026-03-27 11:16 ` [PATCH v2 34/65] target/arm: GICv5 cpuif: Implement ICC_IAFFIDR_EL1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 35/65] target/arm: GICv5 cpuif: Implement ICC_IDR0_EL1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 36/65] target/arm: GICv5 cpuif: Implement GICv5 PPI active set/clear registers Peter Maydell
2026-03-27 11:16 ` [PATCH v2 37/65] target/arm: GICv5 cpuif: Implement PPI handling mode register Peter Maydell
2026-03-27 11:16 ` [PATCH v2 38/65] target/arm: GICv5 cpuif: Implement PPI pending status registers Peter Maydell
2026-03-27 11:16 ` [PATCH v2 39/65] target/arm: GICv5 cpuif: Implement PPI enable register Peter Maydell
2026-03-27 11:16 ` [PATCH v2 40/65] target/arm: GICv5 cpuif: Implement PPI priority registers Peter Maydell
2026-03-27 11:16 ` [PATCH v2 41/65] target/arm: GICv5 cpuif: Implement ICC_APR_EL1 and ICC_HAPR_EL1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 42/65] target/arm: GICv5 cpuif: Calculate the highest priority PPI Peter Maydell
2026-03-27 11:16 ` [PATCH v2 43/65] hw/intc/arm_gicv5: Calculate HPPI in the IRS Peter Maydell
2026-03-27 11:16 ` [PATCH v2 44/65] target/arm: GICv5 cpuif: Implement ICC_CR0_EL1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 45/65] target/arm: GICv5 cpuif: Implement ICC_PCR_EL1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 46/65] target/arm: GICv5 cpuif: Implement ICC_HPPIR_EL1 Peter Maydell
2026-03-27 11:16 ` [PATCH v2 47/65] hw/intc/arm_gicv5: Implement Activate command Peter Maydell
2026-03-27 11:16 ` [PATCH v2 48/65] target/arm: GICv5 cpuif: Implement GICR CDIA command Peter Maydell
2026-03-27 11:16 ` [PATCH v2 49/65] target/arm: GICv5 cpuif: Implement GIC CDEOI Peter Maydell
2026-03-27 11:16 ` [PATCH v2 50/65] hw/intc/arm_gicv5: Implement Deactivate command Peter Maydell
2026-03-27 11:16 ` [PATCH v2 51/65] target/arm: GICv5 cpuif: Implement GIC CDDI Peter Maydell
2026-03-27 11:16 ` [PATCH v2 52/65] target/arm: GICv5 cpuif: Signal IRQ or FIQ Peter Maydell
2026-03-27 11:16 ` [PATCH v2 53/65] target/arm: Connect internal interrupt sources up as GICv5 PPIs Peter Maydell
2026-03-27 11:16 ` [PATCH v2 54/65] target/arm: Add has_gcie property to enable FEAT_GCIE Peter Maydell
2026-03-27 11:16 ` [PATCH v2 55/65] hw/intc/arm_gicv3_cpuif: Don't allow GICv3 if CPU has GICv5 cpuif Peter Maydell
2026-03-27 11:16 ` [PATCH v2 56/65] hw/arm/virt: Remember CPU phandles rather than looking them up by name Peter Maydell
2026-03-27 11:16 ` [PATCH v2 57/65] hw/arm/virt: Move MSI controller creation out of create_gic() Peter Maydell
2026-04-13 22:53   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 58/65] hw/arm/virt: Pull "wire CPU interrupts" " Peter Maydell
2026-04-13 22:55   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 59/65] hw/arm/virt: Split GICv2 and GICv3/4 creation Peter Maydell
2026-03-27 11:16 ` [PATCH v2 60/65] hw/arm/virt: Create and connect GICv5 Peter Maydell
2026-04-14 11:57   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 61/65] hw/arm/virt: Advertise GICv5 in the DTB Peter Maydell
2026-04-13 22:57   ` Philippe Mathieu-Daudé
2026-03-27 11:16 ` [PATCH v2 62/65] hw/arm/virt: Handle GICv5 in interrupt bindings for PPIs Peter Maydell
2026-03-27 11:16 ` [PATCH v2 63/65] hw/arm/virt: Use correct interrupt type for GICv5 SPIs in the DTB Peter Maydell
2026-03-27 11:16 ` [PATCH v2 64/65] hw/arm/virt: Enable GICv5 CPU interface when using GICv5 Peter Maydell
2026-03-27 11:17 ` [PATCH v2 65/65] hw/arm/virt: Allow user to select GICv5 Peter Maydell
2026-04-13 22:59   ` Philippe Mathieu-Daudé
2026-04-24 10:02 ` [PATCH v2 00/65] arm: Implement an emulation of GICv5 interrupt controller Peter Maydell
2026-05-07 13:25 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=079c7160-0374-4cc9-bc76-ba5f7f216ecb@linux.dev \
    --to=zenghui.yu@linux.dev \
    --cc=jonathan.cameron@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.