Re: [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller
From: Thomas Gleixner
Date: Fri Dec 04 2026 - 05:57:08 EST
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