From: Vladimir Murzin <vladimir.murzin@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com,
will@kernel.org, catalin.marinas@arm.com, ruanjinjie@huawei.com,
liaochang1@huawei.com
Subject: Re: [RFC PATCH v2 45/45] irqchip/gic-v5: Add NMI support for IPIs
Date: Fri, 7 Aug 2026 11:42:12 +0100 [thread overview]
Message-ID: <5a78805e-ce2b-4571-a162-9e713f4c0678@arm.com> (raw)
In-Reply-To: <861pcab5gf.wl-maz@kernel.org>
On 8/7/26 11:17, Marc Zyngier wrote:
> On Mon, 27 Jul 2026 17:34:53 +0100,
> Vladimir Murzin <vladimir.murzin@arm.com> wrote:
>> IPIs are implemented as a logical domain on top of the LPI domain.
>> Therefore, when an IPI is configured as an NMI, update the priority in
>> the parent LPI domain during setup and teardown.
>>
>> Permit irq_supports_nmi() to accept IRQs managed by an NMI-capable
>> parent domain.
>>
>> Finally, guard handle_irq_event_percpu() against calling
>> add_interrupt_randomness() from NMI context.
>>
>> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
>> ---
>> drivers/irqchip/irq-gic-v5.c | 23 ++++++++++++++++++++++-
>> kernel/irq/handle.c | 3 ++-
>> kernel/irq/manage.c | 11 ++++++++---
>> 3 files changed, 32 insertions(+), 5 deletions(-)
>>
>> The patch should definitely be split. The only reason I'm keeping it
>> as a single patch for now is that I'm not yet sure these changes are
>> moving in the right direction...
>>
>>
>> diff --git a/drivers/irqchip/irq-gic-v5.c b/drivers/irqchip/irq-gic-v5.c
>> index 05b957ffc0b8..787cb8da4e1a 100644
>> --- a/drivers/irqchip/irq-gic-v5.c
>> +++ b/drivers/irqchip/irq-gic-v5.c
>> @@ -700,6 +700,24 @@ static void gicv5_spi_irq_nmi_teardown(struct irq_data *d)
>> irq_to_desc(d->irq)->handle_irq = handle_fasteoi_irq;
>> }
>>
>> +static int gicv5_ipi_irq_nmi_setup(struct irq_data *d)
>> +{
>> + if (WARN_ON(!d->parent_data))
>> + return -EINVAL;
> How can this happen? Shouldn't that be impossible by construction?
>
Cannot happen, it is just me getting too much addicted to all sorts of checks :)
>> +
>> + d = d->parent_data;
>> +
>> + return gicv5_hwirq_irq_nmi_setup(d->hwirq, GICV5_HWIRQ_TYPE_LPI);
>> +}
>> +
>> +static void gicv5_ipi_irq_nmi_teardown(struct irq_data *d)
>> +{
>> + if (WARN_ON(!d->parent_data))
>> + return;
>> +
>> + d = d->parent_data;
>> +
>> + gicv5_hwirq_irq_nmi_teardown(d->hwirq, GICV5_HWIRQ_TYPE_LPI);
>> }
>>
>> static struct irq_chip gicv5_ppi_irq_chip = {
>> @@ -749,7 +767,7 @@ static struct irq_chip gicv5_lpi_irq_chip = {
>> IRQCHIP_MASK_ON_SUSPEND,
>> };
>>
>> -static const struct irq_chip gicv5_ipi_irq_chip = {
>> +static struct irq_chip gicv5_ipi_irq_chip = {
> If we can't have it const, can we have it as __ro_after_init?
>
Yes, it was rises by Sashiko as well, already applied __ro_after_init locally
>> .name = "GICv5-IPI",
>> .irq_mask = irq_chip_mask_parent,
>> .irq_unmask = irq_chip_unmask_parent,
>> @@ -757,6 +775,8 @@ static const struct irq_chip gicv5_ipi_irq_chip = {
>> .irq_set_affinity = irq_chip_set_affinity_parent,
>> .irq_get_irqchip_state = irq_chip_get_parent_state,
>> .irq_set_irqchip_state = irq_chip_set_parent_state,
>> + .irq_nmi_setup = gicv5_ipi_irq_nmi_setup,
>> + .irq_nmi_teardown = gicv5_ipi_irq_nmi_teardown,
>> .ipi_send_single = gicv5_ipi_send_single,
>> .flags = IRQCHIP_SKIP_SET_WAKE |
>> IRQCHIP_MASK_ON_SUSPEND,
>> @@ -1213,6 +1233,7 @@ static void gicv5_enable_nmi_support(void)
>> gicv5_ppi_irq_chip.flags |= IRQCHIP_SUPPORTS_NMI;
>> gicv5_spi_irq_chip.flags |= IRQCHIP_SUPPORTS_NMI;
>> gicv5_lpi_irq_chip.flags |= IRQCHIP_SUPPORTS_NMI;
>> + gicv5_ipi_irq_chip.flags |= IRQCHIP_SUPPORTS_NMI;
>> }
>>
>> static void __init gicv5_smp_init(void)
>> diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
>> index b7d52821837b..114fd63b0210 100644
>> --- a/kernel/irq/handle.c
>> +++ b/kernel/irq/handle.c
>> @@ -245,7 +245,8 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
>>
>> retval = __handle_irq_event_percpu(desc);
>>
>> - add_interrupt_randomness(desc->irq_data.irq);
>> + if (!in_nmi())
>> + add_interrupt_randomness(desc->irq_data.irq);
> This also needs to be a separate patch.
>
Ack!
>>
>> if (!irq_settings_no_debug(desc))
>> note_interrupt(desc, retval);
>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>> index 7eb07e3bdb4c..0091bb5f7662 100644
>> --- a/kernel/irq/manage.c
>> +++ b/kernel/irq/manage.c
>> @@ -1370,9 +1370,14 @@ static bool irq_supports_nmi(struct irq_desc *desc)
>> struct irq_data *d = irq_desc_get_irq_data(desc);
>>
>> #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
>> - /* Only IRQs directly managed by the root irqchip can be set as NMI */
>> - if (d->parent_data)
>> - return false;
>> + struct irq_data *data;
>> + /*
>> + * Only IRQs directly managed by the root irqchip can be set
>> + * as NMI unless we inherit NMI from parent
>> + */
>> + for (data = d->parent_data; data; data = data->parent_data)
>> + if (!(data->chip && data->chip->flags & IRQCHIP_SUPPORTS_NMI))
>> + return false;
> Maybe we should just trust the local irqchip to do the right
> thing. After all, the core code shouldn't be in the business of
> sanitising broken irqchip drivers advertising random crap.
>
That is indeed bit I was not really sure about, if we decide that we
can trust local irqchip then I assume we just drop the check?
>> #endif
>> /* Don't support NMIs for chips behind a slow bus */
>> if (d->chip->irq_bus_lock || d->chip->irq_bus_sync_unlock)
> Thanks,
>
Thanks!
Vladimir
> M.
>
> -- Without deviation from the norm, progress is not possible.
>
next prev parent reply other threads:[~2026-08-07 10:42 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 16:34 [RFC PATCH v2 00/45] arm64: Add support for FEAT_NMI Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 01/45] arm64: ptrace: Remove INIT_PSTATE_EL2 Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 02/45] arm64: debug: don't mask DAIF for mdscr_write() Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 03/45] arm64: hibernate: mask DAIF before restoring hibernated kernel Vladimir Murzin
2026-07-28 1:17 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 04/45] arm64: hibernate: Restore DAIF state on error Vladimir Murzin
2026-07-28 1:16 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 05/45] arm64: suspend: rely on daif helpers to handle PMR Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 06/45] arm64: suspend: Initialize PMR on resume Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 07/45] arm64: entry: mask DAIF before returning from C EL1 handlers Vladimir Murzin
2026-07-28 2:00 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 08/45] irqchip/gic-v3: make the unmasking of pseudo-NMIs explicit when handling IRQs Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 09/45] arm64: entry: Avoid unnecessary local_irq_disable() on kernel exit Vladimir Murzin
2026-07-28 3:18 ` Jinjie Ruan
2026-08-03 9:32 ` Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 10/45] arm64: irqflags: Introduce arm64-specific irqflags type Vladimir Murzin
2026-07-28 2:42 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 11/45] arm64: irqflags: save and use both DAIF and PMR Vladimir Murzin
2026-07-28 3:46 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 12/45] arm64: interrupts: Add common exception state helpers Vladimir Murzin
2026-07-28 8:20 ` Jinjie Ruan
2026-08-03 9:40 ` Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 13/45] arm64: process: Use helper to check exception state Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 14/45] arm64: entry: Introduce entry specific exception masking helpers Vladimir Murzin
2026-07-28 8:48 ` Jinjie Ruan
2026-08-03 12:12 ` Vladimir Murzin
2026-07-28 9:18 ` Jinjie Ruan
2026-08-03 12:21 ` Vladimir Murzin
2026-07-28 9:29 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 15/45] arm64: entry: replace DAIF helpers with entry helpers Vladimir Murzin
2026-07-28 9:53 ` Jinjie Ruan
2026-08-03 12:23 ` Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 16/45] arm64: interrupts: Introduce exception masking save/restore helpers Vladimir Murzin
2026-07-28 11:56 ` Jinjie Ruan
2026-08-03 12:24 ` Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 17/45] arm64: interrupts: introduce a helper for GIC priority initialization Vladimir Murzin
2026-07-28 11:21 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 18/45] arm64: replace local_daif helpers Vladimir Murzin
2026-07-28 12:04 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 19/45] arm64: cpuidle: use new helpers to bypass interrupt priority masking Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 20/45] arm64: remove daifflags.h Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 21/45] arm64: gicv3: remove GIC_PRIO_PSR_I_SET Vladimir Murzin
2026-07-28 12:08 ` Jinjie Ruan
2026-08-03 12:27 ` Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 22/45] arm64: cpufeature: Remove system_has_prio_mask_debugging() Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 23/45] arm64: irqflags: Switch to CONFIG_DEBUG_IRQFLAGS Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 24/45] arm64: Kconfig: Remove CONFIG_ARM64_DEBUG_PRIORITY_MASKING Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 25/45] efi/runtime-wrappers: Permit architectures to override IRQ flags checks Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 26/45] arm64/efi: Implement override for " Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 27/45] arm64: booting: Document boot requirements for FEAT_NMI Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 28/45] arm64: sysreg: Add definitions for immediate versions of MSR ALLINT Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 29/45] arm64: ptrace: Add PSR_ALLINT_BIT Vladimir Murzin
2026-07-28 3:58 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 30/45] arm64: idreg: Add an override for FEAT_NMI Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 31/45] arm64: cpufeature: Detect PE support " Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 32/45] arm64: nmi: Manage masking for superpriority interrupts Vladimir Murzin
2026-07-28 12:14 ` Jinjie Ruan
2026-08-03 12:28 ` Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 33/45] arm64: irq: Report FEAT_NMI masking local IRQs Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 34/45] arm64: nmi: Add handling of superpriority interrupts as NMIs Vladimir Murzin
2026-07-28 12:25 ` Jinjie Ruan
2026-08-03 12:33 ` Vladimir Murzin
2026-08-07 9:58 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 35/45] arm64: suspend: Always initialise PSTATE.ALLINT Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 36/45] arm64/efi: Add ALLINT to IRQ flags checks Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 37/45] arm64: kprobes: Disable NMIs Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 38/45] arm64: smp: Abstract SGI and LPI operations Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 39/45] arm64: smp: Fall back to IRQ when IPI NMI request fails Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 40/45] arm64: nmi: Add Kconfig for NMI Vladimir Murzin
2026-07-28 6:24 ` Jinjie Ruan
2026-08-03 9:36 ` Vladimir Murzin
2026-08-03 11:37 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 41/45] irqchip/gic-v3: Prepare for FEAT_GICv3_NMI support Vladimir Murzin
2026-07-28 12:29 ` Jinjie Ruan
2026-08-03 12:34 ` Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 42/45] irqchip/gic-v3: Implement " Vladimir Murzin
2026-07-28 12:31 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 43/45] arm64: smp: Add NMI support for LPI-backed IPIs Vladimir Murzin
2026-07-28 12:34 ` Jinjie Ruan
2026-07-27 16:34 ` [RFC PATCH v2 44/45] irqchip/gic-v5: Add NMI support for PPIs, SPIs and LPIs Vladimir Murzin
2026-07-27 16:34 ` [RFC PATCH v2 45/45] irqchip/gic-v5: Add NMI support for IPIs Vladimir Murzin
2026-08-07 10:17 ` Marc Zyngier
2026-08-07 10:42 ` Vladimir Murzin [this message]
2026-08-07 10:57 ` Marc Zyngier
2026-08-07 12:28 ` Vladimir Murzin
2026-08-06 17:11 ` [RFC PATCH v2 00/45] arm64: Add support for FEAT_NMI Will Deacon
2026-08-07 8:33 ` Vladimir Murzin
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=5a78805e-ce2b-4571-a162-9e713f4c0678@arm.com \
--to=vladimir.murzin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=liaochang1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox