Re: [PATCH 3/3] irqchip: xilinx: Use handle_domain_irq()

From: Michal Simek
Date: Fri Feb 21 2020 - 06:50:05 EST


On 21. 02. 20 12:46, Marc Zyngier wrote:
> On 2020-02-12 08:39, Michal Simek wrote:
>> Call generic domain specific irq handler which does the most of things
>> self. Also get rid of concurrent_irq counting which hasn't been exported
>> anywhere.
>> Based on this loop was also optimized by using do/while loop instead of
>> goto loop.
>>
>> Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx>
>> Reviewed-by: Stefan Asserhall <stefan.asserhall@xxxxxxxxxx>
>> ---
>>
>> Âarch/microblaze/KconfigÂÂÂÂÂÂÂÂÂÂ |Â 1 +
>> Âarch/microblaze/kernel/irq.cÂÂÂÂÂ |Â 5 ----
>> Âdrivers/irqchip/irq-xilinx-intc.c | 44 +++++++++++--------------------
>> Â3 files changed, 16 insertions(+), 34 deletions(-)
>>
>> diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
>> index 3a314aa2efa1..242f58ec086b 100644
>> --- a/arch/microblaze/Kconfig
>> +++ b/arch/microblaze/Kconfig
>> @@ -48,6 +48,7 @@ config MICROBLAZE
>> ÂÂÂÂ select MMU_GATHER_NO_RANGE if MMU
>> ÂÂÂÂ select SPARSE_IRQ
>> ÂÂÂÂ select GENERIC_IRQ_MULTI_HANDLER
>> +ÂÂÂ select HANDLE_DOMAIN_IRQ
>>
>> Â# Endianness selection
>> Âchoice
>> diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
>> index 1f8cb4c4f74f..0b37dde60a1e 100644
>> --- a/arch/microblaze/kernel/irq.c
>> +++ b/arch/microblaze/kernel/irq.c
>> @@ -22,13 +22,8 @@
>>
>> Âvoid __irq_entry do_IRQ(struct pt_regs *regs)
>> Â{
>> -ÂÂÂ struct pt_regs *old_regs = set_irq_regs(regs);
>> ÂÂÂÂ trace_hardirqs_off();
>> -
>> -ÂÂÂ irq_enter();
>> ÂÂÂÂ handle_arch_irq(regs);
>> -ÂÂÂ irq_exit();
>> -ÂÂÂ set_irq_regs(old_regs);
>> ÂÂÂÂ trace_hardirqs_on();
>> Â}
>>
>> diff --git a/drivers/irqchip/irq-xilinx-intc.c
>> b/drivers/irqchip/irq-xilinx-intc.c
>> index ad9e678c24ac..fa468e618762 100644
>> --- a/drivers/irqchip/irq-xilinx-intc.c
>> +++ b/drivers/irqchip/irq-xilinx-intc.c
>> @@ -125,20 +125,6 @@ static unsigned int xintc_get_irq_local(struct
>> xintc_irq_chip *irqc)
>> ÂÂÂÂ return irq;
>> Â}
>>
>> -static unsigned int xintc_get_irq(void)
>> -{
>> -ÂÂÂ u32 hwirq;
>> -ÂÂÂ unsigned int irq = -1;
>> -
>> -ÂÂÂ hwirq = xintc_read(primary_intc, IVR);
>> -ÂÂÂ if (hwirq != -1U)
>> -ÂÂÂÂÂÂÂ irq = irq_find_mapping(primary_intc->root_domain, hwirq);
>> -
>> -ÂÂÂ pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq);
>> -
>> -ÂÂÂ return irq;
>> -}
>> -
>> Âstatic int xintc_map(struct irq_domain *d, unsigned int irq,
>> irq_hw_number_t hw)
>> Â{
>> ÂÂÂÂ struct xintc_irq_chip *irqc = d->host_data;
>> @@ -178,23 +164,23 @@ static void xil_intc_irq_handler(struct irq_desc
>> *desc)
>> ÂÂÂÂ chained_irq_exit(chip, desc);
>> Â}
>>
>> -static u32 concurrent_irq;
>> -
>> Âstatic void xil_intc_handle_irq(struct pt_regs *regs)
>> Â{
>> -ÂÂÂ unsigned int irq;
>> -
>> -ÂÂÂ irq = xintc_get_irq();
>> -next_irq:
>> -ÂÂÂ BUG_ON(!irq);
>> -ÂÂÂ generic_handle_irq(irq);
>> -
>> -ÂÂÂ irq = xintc_get_irq();
>> -ÂÂÂ if (irq != -1U) {
>> -ÂÂÂÂÂÂÂ pr_debug("next irq: %d\n", irq);
>> -ÂÂÂÂÂÂÂ ++concurrent_irq;
>> -ÂÂÂÂÂÂÂ goto next_irq;
>> -ÂÂÂ }
>> +ÂÂÂ u32 hwirq;
>> +ÂÂÂ struct xintc_irq_chip *irqc = primary_intc;
>> +
>> +ÂÂÂ do {
>> +ÂÂÂÂÂÂÂ hwirq = xintc_read(irqc, IVR);
>> +ÂÂÂÂÂÂÂ if (hwirq != -1U) {
>> +ÂÂÂÂÂÂÂÂÂÂÂ int ret;
>> +
>> +ÂÂÂÂÂÂÂÂÂÂÂ ret = handle_domain_irq(irqc->root_domain, hwirq, regs);
>> +ÂÂÂÂÂÂÂÂÂÂÂ WARN_ONCE(ret, "Unhandled HWIRQ %d\n", hwirq);
>> +ÂÂÂÂÂÂÂÂÂÂÂ continue;
>> +ÂÂÂÂÂÂÂ }
>> +
>> +ÂÂÂÂÂÂÂ break;
>> +ÂÂÂ } while (1);
>
> OK, so this what I suggested already. Just squash the two patches
> in one, there is no point in keeping them separate.

I sent it exactly how I have done it originally. Not a problem with
squashing that stuff together.

Thanks,
Michal