Skip to contentSkip to conversation

Remove at91 workaround from handle_IRQ

RFC PATCH New Will Deacon 2 participants 5 messages May 31, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Remove at91 workaround from handle_IRQ

Hello,

This is a couple of patches that I wrote quickly to try and remove the irq_finish hook from handle_IRQ on ARM. Currently, the hook is only used by at91 in order to issue an EOI when using level_irq flow control.

This patch moves the at91 irq_chip to fasteoi flow control, removing the need for the additional hook. Since I (a) don't know anything about at91 (the TRM I found for the IRQ controller is only a few pages long) and (b) don't have a platform on which to test, this is very much an RFC series.

All comments welcome.

Will

Cc Arnd Bergmann <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Nicolas Ferre <[email protected]>

Will Deacon (2):
ARM: at91: use EOI flow control for interrupt handling
ARM: irq: remove unused irq_finish hook from core interrupt handling

 arch/arm/kernel/irq.c                  |   10 ----------
 arch/arm/mach-at91/include/mach/irqs.h |    8 --------
 arch/arm/mach-at91/irq.c               |   12 +++++++++---
 3 files changed, 9 insertions(+), 21 deletions(-)
Signature · 1 line
1.7.3.4
#1 lore raw

RFC PATCH 1/2 ARM: at91: use EOI flow control for interrupt handling

This patch updates the at91 interrupt handling to use EOI flow control in preparation for removing the irq_finish hook on ARM.

Cc Arnd Bergmann <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 arch/arm/mach-at91/include/mach/irqs.h |    8 --------
 arch/arm/mach-at91/irq.c               |   12 +++++++++---
 2 files changed, 9 insertions(+), 11 deletions(-)
arch/arm/mach-at91/include/mach/irqs.h +0 -8
index ac8b7df..592cb43 100644
@@ -26,14 +26,6 @@
 
 #define NR_AIC_IRQS 32
 
-
-/*
- * Acknowledge interrupt with AIC after interrupt has been handled.
- *   (by kernel/irq.c)
- */
-#define irq_finish(irq) do { at91_aic_write(AT91_AIC_EOICR, 0); } while (0)
-
-
 /*
  * IRQ interrupt symbols are the AT91xxx_ID_* symbols
  * for IRQs handled directly through the AIC, or else the AT91_PIN_*
arch/arm/mach-at91/irq.c +9 -3
index cfcfcbe..3095fe0 100644
@@ -55,6 +55,12 @@ static void at91_aic_unmask_irq(struct irq_data *d)
 	at91_aic_write(AT91_AIC_IECR, 1 << d->hwirq);
 }
 
+static void at91_aic_eoi_irq(struct irq_data *d)
+{
+	/* Mark end-of-interrupt on AIC */
+	at91_aic_write(AT91_AIC_EOICR, 1 << d->hwirq);
+}
+
 unsigned int at91_extern_irq;
 
 #define is_extern_irq(hwirq) ((1 << (hwirq)) & at91_extern_irq)
@@ -128,9 +134,9 @@ void at91_irq_resume(void)
 
 static struct irq_chip at91_aic_chip = {
 	.name		= "AIC",
-	.irq_ack	= at91_aic_mask_irq,
 	.irq_mask	= at91_aic_mask_irq,
 	.irq_unmask	= at91_aic_unmask_irq,
+	.irq_eoi	= at91_aic_eoi_irq,
 	.irq_set_type	= at91_aic_set_type,
 	.irq_set_wake	= at91_aic_set_wake,
 };
@@ -171,7 +177,7 @@ static int at91_aic_irq_map(struct irq_domain *h, unsigned int virq,
 	/* Active Low interrupt, without priority */
 	at91_aic_write(AT91_AIC_SMR(hw), AT91_AIC_SRCTYPE_LOW);
 
-	irq_set_chip_and_handler(virq, &at91_aic_chip, handle_level_irq);
+	irq_set_chip_and_handler(virq, &at91_aic_chip, handle_fasteoi_irq);
 	set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
 
 	return 0;
@@ -238,7 +244,7 @@ void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS])
 		/* Active Low interrupt, with the specified priority */
 		at91_aic_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]);
 
-		irq_set_chip_and_handler(i, &at91_aic_chip, handle_level_irq);
+		irq_set_chip_and_handler(i, &at91_aic_chip, handle_fasteoi_irq);
 		set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
 	}
 
Signature · 1 line
1.7.3.4
#2 lore raw

RFC PATCH 2/2 ARM: irq: remove unused irq_finish hook from core interrupt handling

In reply to Will Deacon

The irq_finish hook is no longer used by any platforms, so remove it.

Cc Arnd Bergmann <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 arch/arm/kernel/irq.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
arch/arm/kernel/irq.c +0 -10
index 8349d4e..16cedb4 100644
@@ -40,13 +40,6 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
-/*
- * No architecture-specific irq_finish function defined in arm/arch/irqs.h.
- */
-#ifndef irq_finish
-#define irq_finish(irq) do { } while (0)
-#endif
-
 unsigned long irq_err_count;
 
 int arch_show_interrupts(struct seq_file *p, int prec)
@@ -85,9 +78,6 @@ void handle_IRQ(unsigned int irq, struct pt_regs *regs)
 		generic_handle_irq(irq);
 	}
 
-	/* AT91 specific workaround */
-	irq_finish(irq);
-
 	irq_exit();
 	set_irq_regs(old_regs);
 }
Signature · 1 line
1.7.3.4
#3 lore raw

cover Remove at91 workaround from handle_IRQ

In reply to Will Deacon

Hi Will,

Le 05/31/2012 09:38 AM, Will Deacon a ?crit :

Quoted 6 lines

Hello,

This is a couple of patches that I wrote quickly to try and remove the irq_finish hook from handle_IRQ on ARM. Currently, the hook is only used by at91 in order to issue an EOI when using level_irq flow control.

Quoted 8 lines

This patch moves the at91 irq_chip to fasteoi flow control, removing the need for the additional hook. Since I (a) don't know anything about at91 (the TRM I found for the IRQ controller is only a few pages long) and (b) don't have a platform on which to test, this is very much an RFC series.

All comments welcome.

Will

I have sent a patch with the same purpose a few days ago:
http://comments.gmane.org/gmane.linux.ports.arm.kernel/169371

The content of our patches is really close:
- I missed the remove of irq_finish macro in arch/arm/irq/kernel.c
- AIC don't care about the value written into AT91_AIC_EOICR, I don't know if it's better to write 0 or a precise value as you did.
- I didn't remove irq_ack but you're right it's no more useful.
- You missed gpio part, it has to use fasteoi flow control also.

I have also to remove some comments so I can send a second version and add what I missed the first time if you have no objections.

Quoted 4 lines
Cc Arnd Bergmann<[email protected]>
Cc Jean-Christophe Plagniol-Villard<[email protected]>
Cc Nicolas Ferre<[email protected]>
Quoted 9 lines

Will Deacon (2):
ARM: at91: use EOI flow control for interrupt handling
ARM: irq: remove unused irq_finish hook from core interrupt handling

  arch/arm/kernel/irq.c                  |   10 ----------
  arch/arm/mach-at91/include/mach/irqs.h |    8 --------
  arch/arm/mach-at91/irq.c               |   12 +++++++++---
  3 files changed, 9 insertions(+), 21 deletions(-)

Regards

Ludovic

#4 lore raw

cover Remove at91 workaround from handle_IRQ

Quoted 1 line · ludovic.desroches

Hi Will,

Hi Ludovic,

Quoted 4 lines

Le 05/31/2012 09:38 AM, Will Deacon a ?crit :

I have sent a patch with the same purpose a few days ago:
http://comments.gmane.org/gmane.linux.ports.arm.kernel/169371

Great - that means the controller does actually support EOI! I'm sorry that I missed your patches the first time around.

Quoted 2 lines

I have also to remove some comments so I can send a second version and add what I missed the first time if you have no objections.

Sure, please update your patches and CC me on version 2.

Thanks,

Will