linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Richard Clark <richard.xnu.clark@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	torvalds@linux-foundation.org, richard.xnu.clark@gmail.com
Subject: Re: [PATCH] irq: fix the interrupt trigger type override issue
Date: Mon, 02 Sep 2024 09:34:20 +0200	[thread overview]
Message-ID: <87r0a27blv.ffs@tglx> (raw)
In-Reply-To: <ZtUuYXSq8g2Mphuq@den-build>

Richard!

On Mon, Sep 02 2024 at 11:17, Richard Clark wrote:

The subsystem prefix is 'irqdomain' not 'irq'

# git log --online $FILE

gives you a decent hint.

> In current implementation, the trigger type in 'flags' when calling request_irq
> will override the type value get from the firmware(dt/acpi node) if they are
> not consistent, and the overrided trigger type value will be retained by irq_data,
> consequently the type value get from the firmware will not match the retained one
> next time in case the virq is available.
>
> Thus below error message will be observed by the __2nd__ 'insmod' within the
> 'insmod - rmmod - insmod' operation sequence for the same device driver kernel
> module, in which request_irq(..., IRQ_TYPE_LEVEL_HIGH, ...) is used:
>
> 	irq: type mismatch, failed to map hwirq-182 for interrupt-controller!

How so?

1) insmod()
     irq_create_fwspec_mapping(fwspec)
       irq_domain_translate(fwspec, ... &type); <- Sets type to the FW value
     
       virq = irq_find_mapping(domain, hwirq);
       if (virq) {
         // Path not taken
       }

       // Map interrupt
       ...
       
       irqd_set_trigger_type(..., type);

2) rmmod()
     tears down mapping

3) insmod()

      Should be exactly the same as #1 because the previous mapping was
      torn down by rmmod()

Even if the first mapping is not torn down by rmmod(), which is a bug in
itself, then the type is exactly the same as the firmware describes it, no?

So how exactly does that happen what you describe?

> The corresponding 'interrupts' property of that device node is:
> 	interrupts = <0 150 1>;
>
> This commit fixes the above issue by adding a new checker -
> irqd_trigger_type_was_set:

This commit is equaly redundant as 'This patch'

# git grep 'This patch' Documentation/process/

Also 'new checker' is not really a technical term.

Thanks,

        tglx


  reply	other threads:[~2024-09-02  7:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02  3:17 [PATCH] irq: fix the interrupt trigger type override issue Richard Clark
2024-09-02  7:34 ` Thomas Gleixner [this message]
2024-09-02  8:42   ` richard clark
2024-09-02  9:51     ` Thomas Gleixner
2024-09-02 12:50       ` richard clark
2024-09-02 14:39         ` Thomas Gleixner
2024-09-03  7:55           ` Richard Clark
2024-09-03 10:18             ` Thomas Gleixner

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=87r0a27blv.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.xnu.clark@gmail.com \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).