Re: [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller

From: Thomas Gleixner

Date: Sat Dec 05 2026 - 13:40:00 EST


On Fri, Dec 04 2026 at 17:58, Charles Perry wrote:
> On Fri, Dec 04, 2026 at 09:40:14PM +0100, Thomas Gleixner wrote:
>> Which means the input logic is edge type. The output is level type.
>>
>> But you claim the input is level type too. That doesn't make any sense.
>
> I was under the impression that it's the device (and not the interrupt
> controller) that decides if an interrupt is level or edge but maybe I'm
> wrong.

If you connect a level type device to an edge type interrupt controller
or the other way round then you have to keep the pieces.

> If this happens on an input of nvm-intc, then VALUE=1 and STATUS=0.
>
> The way we would handle this with nvm-intc is to check VALUE after unmask()
> and call the interrupt handler again if it is raised. That's not done in
> the patch I sent because I never encountered the issue.

That needs core support, but I really recommend to look into edge
handling first.

The device driver has to make sure, that all interrupt bits in the
device status are cleared before leaving the handler. Then the next
interrupt will create an edge and everything just works.

>> If the interrupt is latched on a rising edge, then you need to treat it
>> as edge interrupt type. The underlying APLIC interrupt can still be
>
> Ok, that should work. IIUC, I should use handle_edge_irq() which
> ->irq_ack() but does not ->irq_mask().
>
> In our first attempt to support this, we added the STATUS register in all
> of the NVM controllers (xSPI, SD, NAND) and each of these drivers would ack
> their interrupt bit in the STATUS register without any masking. That worked
> fine but is a bit of a hack because you need to map the same register in 3
> different drivers.

... and presents a blatant layering violation :)

Thanks,

tglx