[RFC PATCH] irqchip/gic: Implement irq_chip->irq_retrigger()

Valentin Schneider valentin.schneider at arm.com
Fri Jul 10 13:08:01 EDT 2020


On 10/07/20 17:29, Marc Zyngier wrote:
> On Fri, 10 Jul 2020 15:56:42 +0100,
> Valentin Schneider <valentin.schneider at arm.com> wrote:

[...]

>> Implement irq_chip.irq_retrigger() for both GICs.
>
> Although I am very grateful for the whole documentation, I'd rather
> have a slightly more condensed changelog that documents the
> implementation of the retrigger callback! ;-)
>

Hah, indeed! I was relatively unsure about that whole thing, hence why I
sent it as RFC with a wall of text attached. I'll probably strip out the
GIC doc snippets for the "actual" changelog, and talk about the *contents*
of the patch some more.

>>
>> Signed-off-by: Valentin Schneider <valentin.schneider at arm.com>
>> ---
>>  drivers/irqchip/irq-gic-v3.c | 7 +++++++
>>  drivers/irqchip/irq-gic.c    | 6 ++++++
>>  2 files changed, 13 insertions(+)
>>
>> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
>> index cc46bc2d634b..c025e8b51464 100644
>> --- a/drivers/irqchip/irq-gic-v3.c
>> +++ b/drivers/irqchip/irq-gic-v3.c
>> @@ -1207,6 +1207,11 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
>>  #define gic_smp_init()		do { } while(0)
>>  #endif
>>
>> +static int gic_retrigger(struct irq_data *data)
>> +{
>> +	return gic_irq_set_irqchip_state(data, IRQCHIP_STATE_PENDING, true);
>
> If I'm not mistaken, check_irq_resend() requires a non-zero return
> value if the retrigger has succeeded. So something like
>
>       return !gic_irq_set_irqchip_state(data, IRQCHIP_STATE_PENDING, true);
>
> would be more appropriate.
>

Aye, you're right. And while we're at it, we probably still don't want to
fallback to irq_sw_resend() if the retrigger fails, so we should add some
irqd_set_handle_enforce_irqctx() somewhere in the GICs or plainly deselect
CONFIG_HARDIRQS_SW_RESEND.

I'm not very familiar with LPIs just yet, but seeing as they too use
handle_fasteoi_irq() and can't get retriggered, I'd rather play it safe.


This brings me to another point: while this boots just
fine, I didn't get to test out IRQs marked with IRQS_PENDING. IIUC
enable_irq_wake() should give me a decent trail - I see serial_core making
use of it. I'll go give suspend a try.

> Otherwise, looks good.
>

Thanks for having a look!

> Thanks,
>
>       M.



More information about the linux-arm-kernel mailing list