public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lpieralisi@kernel.org>
To: Charles Mirabile <cmirabil@redhat.com>
Cc: fj1078ii@fujitsu.com, catalin.marinas@arm.com,
	fj2767dz@fujitsu.com, guohanjun@huawei.com,
	ilkka@os.amperecomputing.com, lenb@kernel.org,
	linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, rafael@kernel.org,
	sudeep.holla@arm.com, will@kernel.org, tglx@linutronix.de,
	maz@kernel.org
Subject: Re: [PATCH v4] ACPI: AGDI: Add interrupt signaling mode support
Date: Wed, 12 Nov 2025 10:50:19 +0100	[thread overview]
Message-ID: <aRRYW7UK7PWb6cpS@lpieralisi> (raw)
In-Reply-To: <20251112044239.4049011-1-cmirabil@redhat.com>

[+cc Thomas, Marc]

On Tue, Nov 11, 2025 at 11:42:37PM -0500, Charles Mirabile wrote:
> Hi All—
> 
> On Mon, Nov 10, 2025 at 07:38:17AM +0000, Kazuhiro Abe (Fujitsu) wrote:
> > Hi Will,
> > 
> > > Hi Will,
> > > 
> > > > [You don't often get email from will@kernel.org. Learn why this is
> > > > important at https://aka.ms/LearnAboutSenderIdentification ]
> > > >
> > > > On Mon, Oct 20, 2025 at 09:23:05PM +0800, Hanjun Guo wrote:
> > > > > On 2025/10/17 15:39, Kazuhiro Abe wrote:
> > > > > > AGDI has two types of signaling modes: SDEI and interrupt.
> > > > > > Currently, the AGDI driver only supports SDEI.
> > > > > > Therefore, add support for interrupt signaling mode The interrupt
> > > > > > vector is retrieved from the AGDI table, and call panic function
> > > > > > when an interrupt occurs.
> > > > > >
> > > > > > Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> > > > > > Signed-off-by: Kazuhiro Abe <fj1078ii@aa.jp.fujitsu.com>
> > > > > > ---
> > > > > > Hanjun, I have addressed all your comments.
> > > > > > Please review them.
> > > > > >
> > > > > > v3->v4
> > > > > >   - Add a comment to the flags member.
> > > > > >   - Fix agdi_interrupt_probe.
> > > > > >   - Fix agdi_interrupt_remove.
> > > > > >   - Add space in struct initializsation.
> > > > > >   - Delete curly braces.
> > > > >
> > > > > Looks good to me,
> > > > >
> > > > > Acked-by: Hanjun Guo <guohanjun@huawei.com>
> > > >
> > > > I wasn't cc'd on the original patch but I couldn't figure out why it
> > > > uses IRQF_NO_AUTOEN when requesting the irq given that the first thing
> > > > it does is enable it.
> > > 
> > > I misunderstood the usage of request_irq and enable_irq.
> > > Since there's no need to separate them, I will remove IRQF_NO_AUTOEN and the
> > > enable_irq call, and send v5.
> > 
> > I found out when calling request_nmi, removing IRQF_NO_AUTOEN results in an error (-EINVAL).
> > Therefore, I would like to keep IRQF_NO_AUTOEN specified.
> > If you have any comments on this version, please let me know.
> 
> Could it be that this is just a bug in `request_nmi`? I see the following:
> 
> if (!desc || (irq_settings_can_autoenable(desc) &&
>     !(irqflags & IRQF_NO_AUTOEN)) ||
>     !irq_settings_can_request(desc) ||
>     WARN_ON(irq_settings_is_per_cpu_devid(desc)) ||
>     !irq_supports_nmi(desc))
> 	return -EINVAL;
> 
> Perhaps there is just a missing `!` before `irq_settings_can_autoenable`.
> 
> As far as I can tell it has always been wrong - git blame points me to the
> original commit where that code was introduced:
> 
> b525903c254da ("genirq: Provide basic NMI management for interrupt lines")

I don't think that's the right rationale (and I can't claim to understand
it fully either - that's why I added Thomas/Marc in CC).

As per b525903c254da - IIUC NMI must not be autoenable-capable -
enable/disable must be done using enable_nmi/disable_nmi_nosync explicitly.

cbe16f35bee6 ("genirq: Add IRQF_NO_AUTOEN for request_irq/nmi()")
added the logic checking the IRQF_NO_AUTOEN flag to request_nmi().

Now, AFAICS irq_settings_can_autoenable(desc) returns true in this
specific case - the IRQ is a GICv3 SPI.

First question is - before commit cbe16f35bee6, how request_nmi() could
have possibly succeeded - irq_settings_can_autoenable() would return
true and request_nmi() would have failed.

Come cbe16f35bee6:

if (!desc || (irq_settings_can_autoenable(desc) && !(irqflags & IRQF_NO_AUTOEN)) ||
	!irq_settings_can_request(desc) ||
	WARN_ON(irq_settings_is_per_cpu_devid(desc)) ||
	!irq_supports_nmi(desc))
		return -EINVAL;

Now the check passes _if_ you pass in irqflags IRQF_NO_AUTOEN.

I agree with Will that's a bit counterintuitive - maybe we can force
the irqdesc to be NOAUTOEN in request_nmi() directly ?

Thomas and Marc know better so that's where I stop.

Thanks,
Lorenzo

> I looked and the only two callers are using `IRQF_NO_AUTOEN` so I guess it
> just hasn't been noticed yet.
> 
> Happy to send a patch to fix it.
> 
> > 
> > Best Regards,
> > Kazuhiro Abe
> > 
> > > 
> > > Best Regards,
> > > Kazuhiro Abe
> > > 
> > > >
> > > > Will
> 
> Best—Charlie
> 


  parent reply	other threads:[~2025-11-12  9:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  7:39 [PATCH v4] ACPI: AGDI: Add interrupt signaling mode support Kazuhiro Abe
2025-10-20 13:23 ` Hanjun Guo
2025-11-04 16:06   ` Will Deacon
2025-11-06  1:19     ` Kazuhiro Abe (Fujitsu)
2025-11-10  7:38       ` Kazuhiro Abe (Fujitsu)
2025-11-12  4:42         ` Charles Mirabile
2025-11-12  9:18           ` Kazuhiro Abe (Fujitsu)
2025-11-12  9:50           ` Lorenzo Pieralisi [this message]
2025-11-14  8:21           ` Kazuhiro Abe (Fujitsu)
2025-11-14 15:20             ` Charles Mirabile
2025-11-14 15:23               ` Will Deacon
2025-11-18  7:29     ` Hanjun Guo
2025-11-18 10:09       ` Kazuhiro Abe (Fujitsu)
2025-11-20 13:27         ` Hanjun Guo
2025-11-21  2:31           ` Kazuhiro Abe (Fujitsu)

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=aRRYW7UK7PWb6cpS@lpieralisi \
    --to=lpieralisi@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=cmirabil@redhat.com \
    --cc=fj1078ii@fujitsu.com \
    --cc=fj2767dz@fujitsu.com \
    --cc=guohanjun@huawei.com \
    --cc=ilkka@os.amperecomputing.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=tglx@linutronix.de \
    --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