Re: [PATCH 3/3] irqchip/loongson-pch-pic: Reserve legacy LPC irqs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-09-09 05:09, Huacai Chen wrote:
Reserve legacy LPC irqs (0~15) to avoid spurious interrupts.

How can they be spurious? Why are they enabled the first place?

This looks like you are papering over a much bigger issue.

        M.

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>
---
 drivers/irqchip/irq-loongson-pch-pic.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-loongson-pch-pic.c
b/drivers/irqchip/irq-loongson-pch-pic.c
index 9bf6b9a..9f6719c 100644
--- a/drivers/irqchip/irq-loongson-pch-pic.c
+++ b/drivers/irqchip/irq-loongson-pch-pic.c
@@ -35,6 +35,7 @@

 struct pch_pic {
 	void __iomem		*base;
+	struct irq_domain	*lpc_domain;
 	struct irq_domain	*pic_domain;
 	u32			ht_vec_base;
 	raw_spinlock_t		pic_lock;
@@ -184,9 +185,9 @@ static void pch_pic_reset(struct pch_pic *priv)
 static int pch_pic_of_init(struct device_node *node,
 				struct device_node *parent)
 {
+	int i, base, err;
 	struct pch_pic *priv;
 	struct irq_domain *parent_domain;
-	int err;

 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -213,6 +214,22 @@ static int pch_pic_of_init(struct device_node *node,
 		goto iounmap_base;
 	}

+	base = irq_alloc_descs(-1, 0, NR_IRQS_LEGACY, 0);
+	if (base < 0) {
+		pr_err("Failed to allocate LPC IRQ numbers\n");
+		goto iounmap_base;
+	}
+
+	priv->lpc_domain = irq_domain_add_legacy(node, NR_IRQS_LEGACY, 0, 0,
+						 &irq_domain_simple_ops, NULL);
+	if (!priv->lpc_domain) {
+		pr_err("Failed to add irqdomain for LPC controller");
+		goto iounmap_base;
+	}
+
+	for (i = 0; i < NR_IRQS_LEGACY; i++)
+		irq_set_chip_and_handler(i, &dummy_irq_chip, handle_simple_irq);
+
 	priv->pic_domain = irq_domain_create_hierarchy(parent_domain, 0,
 						       PIC_COUNT,
 						       of_node_to_fwnode(node),

--
Jazz is not dead. It just smells funny...



[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux