Skip to contentSkip to conversation

MIPS: Loongson64: Increase NR_IRQS to 320

PATCH Applied Huacai Chen 4 participants 5 messages Sep 11, 2020 – Oct 11, 2020

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

PATCH v2 1/2 MIPS: Loongson64: Increase NR_IRQS to 320

Modernized Loongson64 uses a hierarchical organization for interrupt controllers (INTCs), all INTC nodes (not only leaf nodes) need some IRQ numbers. This means 280 (i.e., NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + 256) is not enough to represent all interrupts, so let's increase NR_IRQS to 320 (NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + NR_MAX_CHAINED_IRQS + 256).

---
 arch/mips/include/asm/mach-loongson64/irq.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/include/asm/mach-loongson64/irq.h +2 -1
index f5e362f7..7450d45 100644
@@ -7,7 +7,8 @@
 /* cpu core interrupt numbers */
 #define NR_IRQS_LEGACY		16
 #define NR_MIPS_CPU_IRQS	8
-#define NR_IRQS			(NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + 256)
+#define NR_MAX_CHAINED_IRQS	40 /* Chained IRQs means those not directly used by devices */
+#define NR_IRQS			(NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + NR_MAX_CHAINED_IRQS + 256)
 
 #define MIPS_CPU_IRQ_BASE 	NR_IRQS_LEGACY
 
Signature · 1 line
2.7.0
#1 lore raw

PATCH v2 2/2 irqchip/loongson-htvec: Fix initial interrupts clearing

In htvec_reset() only the first group of initial interrupts is cleared. This sometimes causes spurious interrupts, so let's clear all groups.

BTW, commit c47e388cfc648421bd821f ("irqchip/loongson-htvec: Support 8 groups of HT vectors") increase interrupt lines from 4 to 8, so update comments as well.

Fixes 818e915fbac518e8c78e1877 ("irqchip: Add Loongson HyperTransport Vector support")
---
 drivers/irqchip/irq-loongson-htvec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-loongson-htvec.c +2 -2
index 13e6016..6392aaf 100644
@@ -151,7 +151,7 @@ static void htvec_reset(struct htvec *priv)
 	/* Clear IRQ cause registers, mask all interrupts */
 	for (idx = 0; idx < priv->num_parents; idx++) {
 		writel_relaxed(0x0, priv->base + HTVEC_EN_OFF + 4 * idx);
-		writel_relaxed(0xFFFFFFFF, priv->base);
+		writel_relaxed(0xFFFFFFFF, priv->base + 4 * idx);
 	}
 }
 
@@ -172,7 +172,7 @@ static int htvec_of_init(struct device_node *node,
 		goto free_priv;
 	}
 
-	/* Interrupt may come from any of the 4 interrupt line */
+	/* Interrupt may come from any of the 8 interrupt lines */
 	for (i = 0; i < HTVEC_MAX_PARENT_IRQ; i++) {
 		parent_irq[i] = irq_of_parse_and_map(node, i);
 		if (parent_irq[i] <= 0)
Signature · 1 line
2.7.0
merge bot Applied
#2 lore raw

[tip: irq/core] irqchip/loongson-htvec: Fix initial interrupt clearing

The following commit has been merged into the irq/core branch of tip:

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     1d1e5630de78f7253ac24b92cee6427c3ff04d56
Gitweb:        https://git.kernel.org/tip/1d1e5630de78f7253ac24b92cee6427c3ff04d56
Author:        Huacai Chen <[email protected]>
AuthorDate:    Fri, 11 Sep 2020 18:26:18 +08:00
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Sun, 13 Sep 2020 15:30:11 +01:00

irqchip/loongson-htvec: Fix initial interrupt clearing

In htvec_reset() only the first group of initial interrupts is cleared. This sometimes causes spurious interrupts, so let's clear all groups.

While at it, fix the nearby comment that to match the reality of what the driver does.

Fixes 818e915fbac518e8c78e1877 ("irqchip: Add Loongson HyperTransport Vector support")
---
 drivers/irqchip/irq-loongson-htvec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-loongson-htvec.c +2 -2
index 13e6016..6392aaf 100644
@@ -151,7 +151,7 @@ static void htvec_reset(struct htvec *priv)
 	/* Clear IRQ cause registers, mask all interrupts */
 	for (idx = 0; idx < priv->num_parents; idx++) {
 		writel_relaxed(0x0, priv->base + HTVEC_EN_OFF + 4 * idx);
-		writel_relaxed(0xFFFFFFFF, priv->base);
+		writel_relaxed(0xFFFFFFFF, priv->base + 4 * idx);
 	}
 }
 
@@ -172,7 +172,7 @@ static int htvec_of_init(struct device_node *node,
 		goto free_priv;
 	}
 
-	/* Interrupt may come from any of the 4 interrupt line */
+	/* Interrupt may come from any of the 8 interrupt lines */
 	for (i = 0; i < HTVEC_MAX_PARENT_IRQ; i++) {
 		parent_irq[i] = irq_of_parse_and_map(node, i);
 		if (parent_irq[i] <= 0)
Applied
#3 lore raw
In reply to Huacai Chen
Quoted 5 lines · Huacai Chen

Modernized Loongson64 uses a hierarchical organization for interrupt controllers (INTCs), all INTC nodes (not only leaf nodes) need some IRQ numbers. This means 280 (i.e., NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + 256) is not enough to represent all interrupts, so let's increase NR_IRQS to 320 (NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + NR_MAX_CHAINED_IRQS + 256).

Applied to irq/irqchip-fixes-5.9, thanks!

[2/2] irqchip/loongson-htvec: Fix initial interrupt clearing

      commit: 1d1e5630de78f7253ac24b92cee6427c3ff04d56

Patch 1/1 can go via the MIPS tree.

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
maintainer Applied
#4 lore raw
In reply to Huacai Chen
Quoted 10 lines · Huacai Chen

Modernized Loongson64 uses a hierarchical organization for interrupt controllers (INTCs), all INTC nodes (not only leaf nodes) need some IRQ numbers. This means 280 (i.e., NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + 256) is not enough to represent all interrupts, so let's increase NR_IRQS to 320 (NR_IRQS_LEGACY + NR_MIPS_CPU_IRQS + NR_MAX_CHAINED_IRQS + 256).

---
 arch/mips/include/asm/mach-loongson64/irq.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]