[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFlw4lOj8tUGrSTb@lpieralisi>
Date: Mon, 23 Jun 2025 17:21:06 +0200
From: Lorenzo Pieralisi <lpieralisi@...nel.org>
To: Sascha Bischoff <Sascha.Bischoff@....com>
Cc: "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>, nd <nd@....com>,
"maz@...nel.org" <maz@...nel.org>,
"oliver.upton@...ux.dev" <oliver.upton@...ux.dev>,
Joey Gouly <Joey.Gouly@....com>,
Suzuki Poulose <Suzuki.Poulose@....com>,
"yuzenghui@...wei.com" <yuzenghui@...wei.com>,
"will@...nel.org" <will@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
Timothy Hayes <Timothy.Hayes@....com>
Subject: Re: [PATCH 1/5] irqchip/gic-v5: Skip deactivate for forwarded PPI
interrupts
On Fri, Jun 20, 2025 at 04:07:50PM +0000, Sascha Bischoff wrote:
> If a PPI interrupt is forwarded to a guest, skip the deactivate and
> only EOI. Rely on the guest deactivating the both the virtual and
"deactivating both"
> physical interrupts (due to ICH_LRx_EL2.HW being set) later on as part
> of handling the injected interrupt. This mimics the behaviour seen on
> native GICv3.
>
> This is part of adding support for the GICv3 compatibility mode on a
> GICv5 host.
>
> Co-authored-by: Timothy Hayes <timothy.hayes@....com>
> Signed-off-by: Timothy Hayes <timothy.hayes@....com>
> Signed-off-by: Sascha Bischoff <sascha.bischoff@....com>
> ---
> drivers/irqchip/irq-gic-v5.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
Reviewed-by: Lorenzo Pieralisi <lpieralisi@...nel.org>
> diff --git a/drivers/irqchip/irq-gic-v5.c b/drivers/irqchip/irq-gic-v5.c
> index 4a0990f46358..28853d51a2ea 100644
> --- a/drivers/irqchip/irq-gic-v5.c
> +++ b/drivers/irqchip/irq-gic-v5.c
> @@ -213,6 +213,12 @@ static void gicv5_hwirq_eoi(u32 hwirq_id, u8 hwirq_type)
>
> static void gicv5_ppi_irq_eoi(struct irq_data *d)
> {
> + /* Skip deactivate for forwarded PPI interrupts */
> + if (irqd_is_forwarded_to_vcpu(d)) {
> + gic_insn(0, CDEOI);
> + return;
> + }
> +
> gicv5_hwirq_eoi(d->hwirq, GICV5_HWIRQ_TYPE_PPI);
> }
>
> @@ -494,6 +500,16 @@ static bool gicv5_ppi_irq_is_level(irq_hw_number_t hwirq)
> return !!(read_ppi_sysreg_s(hwirq, PPI_HM) & bit);
> }
>
> +static int gicv5_ppi_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu)
> +{
> + if (vcpu)
> + irqd_set_forwarded_to_vcpu(d);
> + else
> + irqd_clr_forwarded_to_vcpu(d);
> +
> + return 0;
> +}
> +
> static const struct irq_chip gicv5_ppi_irq_chip = {
> .name = "GICv5-PPI",
> .irq_mask = gicv5_ppi_irq_mask,
> @@ -501,6 +517,7 @@ static const struct irq_chip gicv5_ppi_irq_chip = {
> .irq_eoi = gicv5_ppi_irq_eoi,
> .irq_get_irqchip_state = gicv5_ppi_irq_get_irqchip_state,
> .irq_set_irqchip_state = gicv5_ppi_irq_set_irqchip_state,
> + .irq_set_vcpu_affinity = gicv5_ppi_irq_set_vcpu_affinity,
> .flags = IRQCHIP_SKIP_SET_WAKE |
> IRQCHIP_MASK_ON_SUSPEND,
> };
> --
> 2.34.1
Powered by blists - more mailing lists