Skip to contentSkip to conversation

ARM: GIC irq desciptor bug fix

PATCH New Chao at marvell.com 4 participants 4 messages Dec 2, 2010 – Dec 8, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: GIC irq desciptor bug fix

From: cxie4 <[email protected]>

gic_set_cpu will directly use irq_desc[]. If CONFIG_SPARSE_IRQ is enabled, there is no irq_desc[]. So we need use irq_to_desc(irq) to get the descriptor for irq.

---
 arch/arm/common/gic.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/common/gic.c +7 -1
index 7dfa9a8..6599acb 100644
@@ -160,9 +160,15 @@ static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
 	unsigned int shift = (irq % 4) * 8;
 	unsigned int cpu = cpumask_first(mask_val);
 	u32 val;
+	struct irq_desc *desc;
 
 	spin_lock(&irq_controller_lock);
-	irq_desc[irq].node = cpu;
+	desc = irq_to_desc(irq);
+	if (desc == NULL) {
+		spin_unlock(&irq_controller_lock);
+		return -EINVAL;
+	}
+	desc->node = cpu;
 	val = readl(reg) & ~(0xff << shift);
 	val |= 1 << (cpu + shift);
 	writel(val, reg);
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 ARM: GIC irq desciptor bug fix

I posted the similar patch. but looks better.

Quoted 40 lines · On Thu, Dec 2, 2010 at 3:17 PM, <[email protected]> wrote:

From: cxie4 <[email protected]>

gic_set_cpu will directly use irq_desc[]. If CONFIG_SPARSE_IRQ is enabled, there is no irq_desc[]. So we need use irq_to_desc(irq) to get the descriptor for irq.

---
?arch/arm/common/gic.c | ? ?8 +++++++-
?1 files changed, 7 insertions(+), 1 deletions(-)

arch/arm/common/gic.c +7 -2
index 7dfa9a8..6599acb 100644
@@ -160,9 +160,15 @@ static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
 ? ? ? ?unsigned int shift = (irq % 4) * 8;
 ? ? ? ?unsigned int cpu = cpumask_first(mask_val);
 ? ? ? ?u32 val;
+ ? ? ? struct irq_desc *desc;
 
 ? ? ? ?spin_lock(&irq_controller_lock);
- ? ? ? irq_desc[irq].node = cpu;
+ ? ? ? desc = irq_to_desc(irq);
+ ? ? ? if (desc == NULL) {
+ ? ? ? ? ? ? ? spin_unlock(&irq_controller_lock);
+ ? ? ? ? ? ? ? return -EINVAL;
+ ? ? ? }
+ ? ? ? desc->node = cpu;
 ? ? ? ?val = readl(reg) & ~(0xff << shift);
 ? ? ? ?val |= 1 << (cpu + shift);
 ? ? ? ?writel(val, reg);
--

1.6.3.3

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

PATCH 1/1 ARM: GIC irq desciptor bug fix

In reply to Chao at marvell.com
Quoted 3 lines · Chao at marvell.com

From: cxie4 <[email protected]>

gic_set_cpu will directly use irq_desc[]. If CONFIG_SPARSE_IRQ is enabled, there is no

"SPARSE_IRQ" will do. Please also wrap commit comments so they fit within 72 columns.

Quoted 1 line

irq_desc[]. So we need use irq_to_desc(irq) to get the descriptor for irq.

Patch looks fine, please send (with Kyungmin's ack) to my patch system, thanks.

#3 lore raw

PATCH 1/1 ARM: GIC irq desciptor bug fix

In reply to Chao at marvell.com
Quoted 1 line · Chao at marvell.com

From: cxie4 <[email protected]>

I think you should have your full name here.

Quoted 16 lines

gic_set_cpu will directly use irq_desc[]. If CONFIG_SPARSE_IRQ is enabled, there is no irq_desc[]. So we need use irq_to_desc(irq) to get the descriptor for irq.

---
 arch/arm/common/gic.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/common/gic.c +0 -0
index 7dfa9a8..6599acb 100644
@@ -160,9 +160,15 @@ static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
 	unsigned int shift = (irq % 4) * 8;
 	unsigned int cpu = cpumask_first(mask_val);

arch/arm/common/gic.c static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val) · line 170

Quoted 10 lines
arch/arm/common/gic.c +6 -1
 	u32 val;
+	struct irq_desc *desc;
 
 	spin_lock(&irq_controller_lock);
-	irq_desc[irq].node = cpu;
+	desc = irq_to_desc(irq);
+	if (desc == NULL) {
+		spin_unlock(&irq_controller_lock);
+		return -EINVAL;
+	}

Hmm, NULL would be quite a problem, should we BUG() on this or maybe WARN on it?

Quoted 4 lines
arch/arm/common/gic.c +1 -0
+	desc->node = cpu;
 	val = readl(reg) & ~(0xff << shift);
 	val |= 1 << (cpu + shift);
 	writel(val, reg);