Skip to contentSkip to conversation

Fix arm GIC irq mask calculations on complex arm devices

PATCH Superseded Lennart Sorensen 2 participants 5 messages May 21, 2015 – May 24, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix arm GIC irq mask calculations on complex arm devices

Complex arm devices like the TI AM572x have IRQ crossbars that can make interrupt numbers map to just about anything you want. This means that the value of d->irq and d->hwirq do not have to have anything to do with each other. The unpatched kernel uses the inline function gic_irq() to get this mapping, rather than d->irq. Restore the code to the unpatched kernel state, and update the ipipe gic_hold_irq/gic_release_irq functions to use gic_irq() too.

This fixes booting with 3.14.39 on the TI AM572x.

---
 drivers/irqchip/irq-gic.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/irqchip/irq-gic.c +4 -4
index 7a68905..c4ff114 100644
@@ -155,7 +155,7 @@ static inline unsigned int gic_irq(struct irq_data *d)
  */
 static void gic_mask_irq(struct irq_data *d)
 {
-	u32 mask = 1 << (d->irq % 32);
+	u32 mask = 1 << (gic_irq(d) % 32);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -168,7 +168,7 @@ static void gic_mask_irq(struct irq_data *d)
 
 static void gic_unmask_irq(struct irq_data *d)
 {
-	u32 mask = 1 << (d->irq % 32);
+	u32 mask = 1 << (gic_irq(d) % 32);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -195,7 +195,7 @@ static void gic_eoi_irq(struct irq_data *d)
 
 static void gic_hold_irq(struct irq_data *d)
 {
-	u32 mask = 1 << (d->irq % 32);
+	u32 mask = 1 << (gic_irq(d) % 32);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
@@ -211,7 +211,7 @@ static void gic_hold_irq(struct irq_data *d)
 
 static void gic_release_irq(struct irq_data *d)
 {
-	u32 mask = 1 << (d->irq % 32);
+	u32 mask = 1 << (gic_irq(d) % 32);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave_cond(&irq_controller_lock, flags);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 9 lines · Lennart Sorensen

Complex arm devices like the TI AM572x have IRQ crossbars that can make interrupt numbers map to just about anything you want. This means that the value of d->irq and d->hwirq do not have to have anything to do with each other. The unpatched kernel uses the inline function gic_irq() to get this mapping, rather than d->irq. Restore the code to the unpatched kernel state, and update the ipipe gic_hold_irq/gic_release_irq functions to use gic_irq() too.

This fixes booting with 3.14.39 on the TI AM572x.

This applies cleanly to ipipe-3.14 and ipipe-3.16 and with a 1 line offset to ipipe-3.18 and master.

Signature · 1 line
Len Sorensen
#2 lore raw
In reply to Lennart Sorensen
Quoted 2 lines · Lennart Sorensen

Complex arm devices like the TI AM572x have IRQ crossbars that can make interrupt numbers map to just about anything you want.

The difference between d->hwirq and d->irq has nothing to do with any crossbar. It is simply a relatively recent evolution of the Linux kernel where the space for software interrupts is separated from the space for hardware interrupts. Not all interrupt controllers have been converted from a version to the next, so the I-pipe patch has to play catch-up with each version converting more interrupt controllers. Business as usual.

Signature · 1 line
					    Gilles.
#3 lore raw
Quoted 11 lines · Gilles Chanteperdrix
Quoted 2 lines · Lennart Sorensen

Complex arm devices like the TI AM572x have IRQ crossbars that can make interrupt numbers map to just about anything you want.

The difference between d->hwirq and d->irq has nothing to do with any crossbar. It is simply a relatively recent evolution of the Linux kernel where the space for software interrupts is separated from the space for hardware interrupts. Not all interrupt controllers have been converted from a version to the next, so the I-pipe patch has to play catch-up with each version converting more interrupt controllers. Business as usual.

OK. Want an update with a simpler commit message, or will you clean it up?

Signature · 1 line
Len Sorensen
#4 lore raw
Quoted 13 lines · Lennart Sorensen
Quoted 11 lines · Gilles Chanteperdrix
Quoted 2 lines · Lennart Sorensen

Complex arm devices like the TI AM572x have IRQ crossbars that can make interrupt numbers map to just about anything you want.

The difference between d->hwirq and d->irq has nothing to do with any crossbar. It is simply a relatively recent evolution of the Linux kernel where the space for software interrupts is separated from the space for hardware interrupts. Not all interrupt controllers have been converted from a version to the next, so the I-pipe patch has to play catch-up with each version converting more interrupt controllers. Business as usual.

Quoted 2 lines

OK. Want an update with a simpler commit message, or will you clean it up?

Please update.

Signature · 1 line
					    Gilles.