The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: Charles Perry <charles.perry@microchip.com>
Cc: Charles Perry <charles.perry@microchip.com>,
	Radu Rendec <radu@rendec.net>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Romain Caritey <romain.caritey@microchip.com>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller
Date: Fri, 04 Dec 2026 11:57:00 +0100	[thread overview]
Message-ID: <87wlppmhz7.ffs@fw13> (raw)
In-Reply-To: <axGxlRgFGqDfiwuq@MON-LT-C78453.mchp-main.com>

On Thu, Dec 03 2026 at 13:14, Charles Perry wrote:

> On Thu, Dec 03, 2026 at 11:35:20AM +0100, Thomas Gleixner wrote:
>> On Wed, Dec 02 2026 at 17:20, Charles Perry wrote:
>> > On Tue, Dec 01, 2026 at 08:31:19PM +0100, Thomas Gleixner wrote:
>> >> > +	 * Clear it, then dispatch only the sources whose line is still high.
>> >> > +	 */
>> >> > +	writel(pending, intc->base + P64H_NVM_INTC_STATUS);
>> >> 
>> >> What happens in the case that there is only BIT(N) pending in STATUS and
>> >> that bit is not set in ENABLED?
>> >
>> > That happens only with PREEMPT_RT.
>> 
>> I don't think that's a PREEMPT_RT issue. That's an issue related to
>> threaded interrupts. Just add 'threadirqs' on the kernel command line
>> with a !RT kernel and you should observe the same.
>
> I've tested 'threadirqs' with !RT and I observe the same thing as with RT.

Not a surprise.

Let's look how level interrupt controllers work in general:

Hardware			CPU

Line is raised
                                interrupt is raised
                                  interrupt()
                                    handle_level_irq()
                                      mask_ack()
                                      device_handler()
Line is cleared                                       ...
                                      unmask()

The mask_ack() does two things:

    1) It masks the interrupt so the it can't be raised again until the
       device handler completed. That's required because with level type
       the interrupt line stays raised until the device handler cleared
       it in the device.

    2) It acks the interrupt, which resets the logic in the interrupt
       chip to raise the interrupt in the CPU again.
       
So if ACK happens without masking the interrupt stays asserted or the
ACK might cause a 1-0-1 transition in some chips.

Threaded mode does not really change this:

     interrupt is raised
       interrupt()
         handle_level_irq()
           mask_ack()
           wake_thread()
           return	// interrupt stays masked

     thread()
       device_handler()
       unmask()

All what changes is the timing.

So this sequence:

   pending = read(STATUS) & read(ENABLE);

   write(pending, STATUS);

   pending &= read(STATUS);

does not make sense for a sanely designed level type controller which
usually does:

   STATUS = LINESTATE & ENABLED

and if it has multiple input lines then the output is simply:

    OUTLINE = STATUS(0) | STATUS(1) .... | STATUS(N)

From your code and comments it seems STATUS is latched which does not
make sense.

But even then it does not explain how the status bit stays raised with
the mask_ack() sequence of the level handler.

That makes me very confident that these SoCs are redefining the future
for space and mission critical applications :)

Thanks,

        tglx




  reply	other threads:[~2026-12-04 10:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 16:06 [PATCH 0/2] Add support for Microchip PIC64-HPSC/HX NVM interrupt controller Charles Perry
2026-12-01 16:06 ` [PATCH 1/2] dt-bindings: interrupt-controller: document Microchip PIC64-HPSC/HX NVM intc Charles Perry
2026-12-01 18:13   ` Conor Dooley
2026-12-02 16:44     ` Charles Perry
2026-12-01 16:06 ` [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller Charles Perry
2026-12-01 19:31   ` Thomas Gleixner
2026-12-02 22:20     ` Charles Perry
2026-12-03 10:35       ` Thomas Gleixner
2026-12-03 18:14         ` Charles Perry
2026-12-04 10:57           ` Thomas Gleixner [this message]
2026-12-04 15:54             ` Charles Perry
2026-12-04 20:40               ` Thomas Gleixner
2026-12-04 11:00   ` 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=87wlppmhz7.ffs@fw13 \
    --to=tglx@kernel.org \
    --cc=charles.perry@microchip.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=radu@rendec.net \
    --cc=robh@kernel.org \
    --cc=romain.caritey@microchip.com \
    /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