[PATCH 0/3] Add virq mapping debugfs for PowerPC

STALE6963d

18 messages, 6 authors, 2007-07-31 · open the first message on its own page

[PATCH 0/3] Add virq mapping debugfs for PowerPC

From: Chen Gong <hidden>
Date: 2007-07-23 11:06:01

Cc: g.chen@freescale.com

Hi

These patches are the update as follows:
http://ozlabs.org/pipermail/linuxppc-dev/2007-March/033091.html
http://ozlabs.org/pipermail/linuxppc-dev/2007-March/033093.html
http://ozlabs.org/pipermail/linuxppc-dev/2007-March/033092.html
http://ozlabs.org/pipermail/linuxppc-dev/2007-March/033094.html

These patches are used for supplying virq mapping debugfs function.
It can be used for displaying irq-virq mapping relationship under debugfs.
Meanwhile, to express these information more clearly, we also add a new member
named "name" for struct irq_host.

[PATCH 1/3] Add a new member name to structure irq_host
[PATCH 2/3] Add irq host name for interrupt controllors
[PATCH 3/3] Add irq debugfs and virq mapping for getting the virq

Any feedback is welcome!

Best Regards,
Chen Gong

[PATCH 3/3] Add irq debugfs and virq_mapping for getting the virq

From: Chen Gong <hidden>
Date: 2007-07-23 11:05:51

This patch adds irq debugfs and virq_mapping for getting the virq.
The virq_mapping node is in powerpc/irq directory of the root debugfs.

Signed-off-by: Zhang Wei <redacted>
Signed-off-by: Chen Gong <redacted>
---
 arch/powerpc/Kconfig.debug        |    7 ++
 arch/powerpc/kernel/Makefile      |    1 +
 arch/powerpc/kernel/irq_debugfs.c |  140 +++++++++++++++++++++++++++++++++++++
 3 files changed, 148 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/kernel/irq_debugfs.c
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 346cd3b..7ae8df1 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -2,6 +2,13 @@ menu "Kernel hacking"
 
 source "lib/Kconfig.debug"
 
+config PPC_VIRQ_DEBUGFS
+	bool "Check virqs mapping"
+	depends on DEBUG_FS
+	help
+	  This option will show the mapping relationship between hardware irq
+	  and virtual irq based on debugfs
+
 config DEBUG_STACKOVERFLOW
 	bool "Check for stack overflows"
 	depends on DEBUG_KERNEL
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 42c42ec..cc3e1e5 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -15,6 +15,7 @@ obj-y				:= semaphore.o cputable.o ptrace.o syscalls.o \
 				   init_task.o process.o systbl.o idle.o \
 				   signal.o
 obj-y				+= vdso32/
+obj-$(CONFIG_PPC_VIRQ_DEBUGFS)	+= irq_debugfs.o
 obj-$(CONFIG_PPC64)		+= setup_64.o binfmt_elf32.o sys_ppc32.o \
 				   signal_64.o ptrace32.o \
 				   paca.o cpu_setup_ppc970.o \
diff --git a/arch/powerpc/kernel/irq_debugfs.c b/arch/powerpc/kernel/irq_debugfs.c
new file mode 100644
index 0000000..53ac12e
--- /dev/null
+++ b/arch/powerpc/kernel/irq_debugfs.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Auther: Zhang Wei <wei.zhang@freescale.com>
+ *
+ * Description:
+ * This file is used for debug the irq. It will create 'irq' directory
+ * in the powerpc directory of debugfs.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/threads.h>
+#include <linux/kernel_stat.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/ptrace.h>
+#include <linux/ioport.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/seq_file.h>
+#include <linux/mutex.h>
+#include <linux/list.h>
+
+#include <asm/uaccess.h>
+#include <asm/system.h>
+#include <asm/irq.h>
+#include <asm/pgtable.h>
+#include <asm/prom.h>
+
+extern struct dentry *powerpc_debugfs_root;
+
+static void *irq_dbg_start(struct seq_file *m, loff_t *pos)
+{
+	return (*pos <= NR_IRQS) ? pos : NULL;
+}
+
+static void *irq_dbg_next(struct seq_file *m, void *p, loff_t * pos)
+{
+	(*pos)++;
+
+	return (*pos <= NR_IRQS) ? pos : NULL;
+}
+
+static void irq_dbg_stop(struct seq_file *m, void *p)
+{
+	/* Nothing to do */
+}
+
+static int irq_dbg_show(struct seq_file *m, void *p)
+{
+	int i = *(loff_t *)p;
+	struct irqaction *action;
+	irq_desc_t *desc;
+	unsigned long flags;
+
+	if (i == 0)
+		seq_puts(m, "VIRQ  HWIRQ  Chip Name   Host Name\n");
+
+	if (i < NR_IRQS) {
+		desc = get_irq_desc(i);
+		spin_lock_irqsave(&desc->lock, flags);
+		action = desc->action;
+		if (!action || !action->handler)
+			goto skip;
+		seq_printf(m, "%3d: ", i);
+
+		seq_printf(m, "  %3d ", (irq_map[i].host->revmap_type == IRQ_HOST_MAP_LEGACY) ? i : virq_to_hw(i));
+
+		if (desc->chip)
+			seq_printf(m, "  %s ", desc->chip->typename);
+		else
+			seq_puts(m, "  None      ");
+
+		seq_printf(m, " %s ", (irq_map[i].host->name) ? irq_map[i].host->name : "  None  ");
+		seq_putc(m, '\n');
+skip:
+		spin_unlock_irqrestore(&desc->lock, flags);
+	} else if (i == NR_IRQS) {
+#ifdef CONFIG_PPC32
+#ifdef CONFIG_TAU_INT
+		if (tau_initialized)
+			seq_puts(m, "TAU:   PowerPC             Thermal Assist (cpu temp)\n");
+#endif
+#endif /* CONFIG_PPC32 */
+	}
+
+	return 0;
+}
+
+static struct seq_operations irq_dbg_seq_ops = {
+	.start = irq_dbg_start,
+	.next  = irq_dbg_next,
+	.stop  = irq_dbg_stop,
+	.show  = irq_dbg_show
+};
+
+static int irq_dbg_seq_open(struct inode *inode, struct file *file)
+{
+	int rc;
+	struct seq_file *seq;
+
+	rc = seq_open(file, &irq_dbg_seq_ops);
+	seq = file->private_data;
+	seq->private = file->f_path.dentry->d_inode->i_private;
+
+	return rc;
+}
+
+static const struct file_operations irq_dbg_seq_fops = {
+	.open = irq_dbg_seq_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = seq_release,
+};
+
+static int __init irq_debugfs_init(void)
+{
+	struct dentry *irq_root;
+	struct dentry *irq_file;
+
+	if (!powerpc_debugfs_root)
+		return 1;
+
+	irq_root = debugfs_create_dir("irq", powerpc_debugfs_root);
+	if (!irq_root)
+		return -ENOMEM;
+
+	irq_file = debugfs_create_file("virq_mapping", S_IRUGO,
+			irq_root, NULL, &irq_dbg_seq_fops);
+	if (!irq_file)
+		return -ENOMEM;
+
+	return 0;
+}
+__initcall(irq_debugfs_init);
-- 
1.5.1

[PATCH 1/3] Add a new member name to structure irq_host

From: Chen Gong <hidden>
Date: 2007-07-23 11:05:51

This patch adds a new member 'name' for irq host's name to
structure irq_host and modifies the definition of the
function irq_alloc_host(). The assignment to the
irq host's name is also added to irq_alloc_host().

Signed-off-by: Zhang Wei <redacted>
Signed-off-by: Chen Gong <redacted>
---
 arch/powerpc/kernel/irq.c |    4 +++-
 include/asm-powerpc/irq.h |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 2fc8786..2c46c6d 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -421,7 +421,8 @@ EXPORT_SYMBOL_GPL(virq_to_hw);
 struct irq_host *irq_alloc_host(unsigned int revmap_type,
 				unsigned int revmap_arg,
 				struct irq_host_ops *ops,
-				irq_hw_number_t inval_irq)
+				irq_hw_number_t inval_irq,
+				const char *name)
 {
 	struct irq_host *host;
 	unsigned int size = sizeof(struct irq_host);
@@ -446,6 +447,7 @@ struct irq_host *irq_alloc_host(unsigned int revmap_type,
 	host->revmap_type = revmap_type;
 	host->inval_irq = inval_irq;
 	host->ops = ops;
+	host->name = name;
 
 	spin_lock_irqsave(&irq_big_lock, flags);
 
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 0485c53..cd0ba2d 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -124,6 +124,7 @@ struct irq_host {
 	struct irq_host_ops	*ops;
 	void			*host_data;
 	irq_hw_number_t		inval_irq;
+	const char		*name;
 };
 
 /* The main irq map itself is an array of NR_IRQ entries containing the
@@ -159,7 +160,8 @@ extern irq_hw_number_t virq_to_hw(unsigned int virq);
 extern struct irq_host *irq_alloc_host(unsigned int revmap_type,
 				       unsigned int revmap_arg,
 				       struct irq_host_ops *ops,
-				       irq_hw_number_t inval_irq);
+				       irq_hw_number_t inval_irq,
+				       const char *name);
 
 
 /**
-- 
1.5.1

[PATCH 2/3] Add irq host name for all powerpc interrupt controllors.

From: Chen Gong <hidden>
Date: 2007-07-23 11:05:51

If there is an OF-tree node for the interrupt controller, we will
use ofnode->full_name as the INT controller's name.
NULL is a proper choice if there is not binding OF-tree node
for the INT controller.

Signed-off-by: Zhang Wei <redacted>
Signed-off-by: Chen Gong <redacted>
---
 arch/powerpc/platforms/52xx/mpc52xx_pic.c |    2 +-
 arch/powerpc/platforms/82xx/mpc82xx_ads.c |    2 +-
 arch/powerpc/platforms/cell/interrupt.c   |    2 +-
 arch/powerpc/platforms/cell/spider-pic.c  |    2 +-
 arch/powerpc/platforms/celleb/interrupt.c |    2 +-
 arch/powerpc/platforms/iseries/irq.c      |    2 +-
 arch/powerpc/platforms/powermac/pic.c     |    2 +-
 arch/powerpc/platforms/ps3/interrupt.c    |    2 +-
 arch/powerpc/platforms/pseries/xics.c     |    2 +-
 arch/powerpc/sysdev/commproc.c            |    3 ++-
 arch/powerpc/sysdev/cpm2_pic.c            |    2 +-
 arch/powerpc/sysdev/i8259.c               |    3 ++-
 arch/powerpc/sysdev/ipic.c                |    3 ++-
 arch/powerpc/sysdev/mpc8xx_pic.c          |    2 +-
 arch/powerpc/sysdev/mpic.c                |    3 ++-
 arch/powerpc/sysdev/mv64x60_pic.c         |    3 ++-
 arch/powerpc/sysdev/qe_lib/qe_ic.c        |    3 ++-
 arch/powerpc/sysdev/tsi108_pci.c          |    2 +-
 arch/powerpc/sysdev/uic.c                 |    2 +-
 19 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index fbfff95..d5efdbc 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -422,7 +422,7 @@ void __init mpc52xx_init_irq(void)
 
 	mpc52xx_irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR,
 	                                 MPC52xx_IRQ_HIGHTESTHWIRQ,
-	                                 &mpc52xx_irqhost_ops, -1);
+	                                 &mpc52xx_irqhost_ops, -1, picnode->full_name);
 
 	if (!mpc52xx_irqhost)
 		panic(__FILE__ ": Cannot allocate the IRQ host\n");
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
index da20832..3e27d3d 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
@@ -503,7 +503,7 @@ void m82xx_pci_init_irq(void)
 	iounmap(immap);
 	pci_pic_host =
 	    irq_alloc_host(IRQ_HOST_MAP_LINEAR, irq_max - irq_min + 1,
-			   &pci_pic_host_ops, irq_max + 1);
+			   &pci_pic_host_ops, irq_max + 1, NULL);
 	return;
 }
 
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 47264e7..9768ba2 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -382,7 +382,7 @@ void __init iic_init_IRQ(void)
 {
 	/* Setup an irq host data structure */
 	iic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, IIC_SOURCE_COUNT,
-				  &iic_host_ops, IIC_IRQ_INVALID);
+				  &iic_host_ops, IIC_IRQ_INVALID, NULL);
 	BUG_ON(iic_host == NULL);
 	irq_set_default_host(iic_host);
 
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 05f4b3d..79c8d4f 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -309,7 +309,7 @@ static void __init spider_init_one(struct device_node *of_node, int chip,
 
 	/* Allocate a host */
 	pic->host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, SPIDER_SRC_COUNT,
-				   &spider_host_ops, SPIDER_IRQ_INVALID);
+				   &spider_host_ops, SPIDER_IRQ_INVALID, of_node->full_name);
 	if (pic->host == NULL)
 		panic("spider_pic: can't allocate irq host !");
 	pic->host->host_data = pic;
diff --git a/arch/powerpc/platforms/celleb/interrupt.c b/arch/powerpc/platforms/celleb/interrupt.c
index 98e6665..0a08a99 100644
--- a/arch/powerpc/platforms/celleb/interrupt.c
+++ b/arch/powerpc/platforms/celleb/interrupt.c
@@ -244,7 +244,7 @@ void __init beatic_init_IRQ(void)
 	/* Allocate an irq host */
 	beatic_host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0,
 					 &beatic_pic_host_ops,
-					 0);
+					 0, NULL);
 	BUG_ON(beatic_host == NULL);
 	irq_set_default_host(beatic_host);
 }
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index 63b3367..766f5d3 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -369,7 +369,7 @@ void __init iSeries_init_IRQ(void)
 	/* Create irq host. No need for a revmap since HV will give us
 	 * back our virtual irq number
 	 */
-	host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0, &iseries_irq_host_ops, 0);
+	host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0, &iseries_irq_host_ops, 0, NULL);
 	BUG_ON(host == NULL);
 	irq_set_default_host(host);
 
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 87cd680..9d4b3e1 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -386,7 +386,7 @@ static void __init pmac_pic_probe_oldstyle(void)
 	 */
 	pmac_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, max_irqs,
 				       &pmac_pic_host_ops,
-				       max_irqs);
+				       max_irqs, NULL);
 	BUG_ON(pmac_pic_host == NULL);
 	irq_set_default_host(pmac_pic_host);
 
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 67e32ec..2b56b81 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -727,7 +727,7 @@ void __init ps3_init_IRQ(void)
 	struct irq_host *host;
 
 	host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0, &ps3_host_ops,
-		PS3_INVALID_OUTLET);
+		PS3_INVALID_OUTLET, NULL);
 	irq_set_default_host(host);
 	irq_set_virq_count(PS3_PLUG_MAX + 1);
 
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 5bd90a7..7f8a5c7 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -541,7 +541,7 @@ static void __init xics_init_host(void)
 	else
 		ops = &xics_host_direct_ops;
 	xics_host = irq_alloc_host(IRQ_HOST_MAP_TREE, 0, ops,
-				   XICS_IRQ_SPURIOUS);
+				   XICS_IRQ_SPURIOUS, NULL);
 	BUG_ON(xics_host == NULL);
 	irq_set_default_host(xics_host);
 }
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index 4f67b89..91dc738 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -167,7 +167,8 @@ unsigned int cpm_pic_init(void)
 
 	cpm_pic_node = of_node_get(np);
 
-	cpm_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &cpm_pic_host_ops, 64);
+	cpm_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &cpm_pic_host_ops, 64,
+			cpm_pic_node->full_name);
 	if (cpm_pic_host == NULL) {
 		printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n");
 		sirq = NO_IRQ;
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index eabfe06..1aaebf8 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -274,7 +274,7 @@ void cpm2_pic_init(struct device_node *node)
 
 	/* create a legacy host */
 	cpm2_pic_node = of_node_get(node);
-	cpm2_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &cpm2_pic_host_ops, 64);
+	cpm2_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &cpm2_pic_host_ops, 64, cpm2_pic_node->full_name);
 	if (cpm2_pic_host == NULL) {
 		printk(KERN_ERR "CPM2 PIC: failed to allocate irq host!\n");
 		return;
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index ad87adc..e80c127 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -278,7 +278,8 @@ void i8259_init(struct device_node *node, unsigned long intack_addr)
 	/* create a legacy host */
 	if (node)
 		i8259_node = of_node_get(node);
-	i8259_host = irq_alloc_host(IRQ_HOST_MAP_LEGACY, 0, &i8259_host_ops, 0);
+	i8259_host = irq_alloc_host(IRQ_HOST_MAP_LEGACY, 0, &i8259_host_ops, 0,
+			(node) ? i8259_node->full_name : NULL);
 	if (i8259_host == NULL) {
 		printk(KERN_ERR "i8259: failed to allocate irq host !\n");
 		return;
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index 473c415..4fe6770 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -572,7 +572,8 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags)
 
 	ipic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR,
 				       NR_IPIC_INTS,
-				       &ipic_host_ops, 0);
+				       &ipic_host_ops, 0,
+				       ipic->of_node->full_name);
 	if (ipic->irqhost == NULL) {
 		of_node_put(node);
 		return NULL;
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c
index 2fc2bcd..c3eb805 100644
--- a/arch/powerpc/sysdev/mpc8xx_pic.c
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -187,7 +187,7 @@ int mpc8xx_pic_init(void)
 	if (siu_reg == NULL)
 		return -EINVAL;
 
-	mpc8xx_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &mpc8xx_pic_host_ops, 64);
+	mpc8xx_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 64, &mpc8xx_pic_host_ops, 64, np->full_name);
 	if (mpc8xx_pic_host == NULL) {
 		printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n");
 		ret = -ENOMEM;
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 74c64c0..d71441e 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -989,7 +989,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 
 	mpic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, isu_size,
 				       &mpic_host_ops,
-				       flags & MPIC_LARGE_VECTORS ? 2048 : 256);
+				       flags & MPIC_LARGE_VECTORS ? 2048 : 256,
+				       mpic->of_node->full_name);
 	if (mpic->irqhost == NULL) {
 		of_node_put(node);
 		return NULL;
diff --git a/arch/powerpc/sysdev/mv64x60_pic.c b/arch/powerpc/sysdev/mv64x60_pic.c
index 01d3162..2bb5b12 100644
--- a/arch/powerpc/sysdev/mv64x60_pic.c
+++ b/arch/powerpc/sysdev/mv64x60_pic.c
@@ -257,7 +257,8 @@ void __init mv64x60_init_irq(void)
 	mv64x60_irq_reg_base = ioremap(paddr, reg[1]);
 
 	mv64x60_irq_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, MV64x60_NUM_IRQS,
-					  &mv64x60_host_ops, MV64x60_NUM_IRQS);
+					  &mv64x60_host_ops, MV64x60_NUM_IRQS,
+					  np->full_name);
 
 	mv64x60_irq_host->host_data = np;
 
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 4d1dcb4..1e78a02 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -355,7 +355,8 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags)
 	qe_ic->of_node = of_node_get(node);
 
 	qe_ic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR,
-					NR_QE_IC_INTS, &qe_ic_host_ops, 0);
+					NR_QE_IC_INTS, &qe_ic_host_ops, 0,
+					qe_ic->of_node->full_name);
 	if (qe_ic->irqhost == NULL) {
 		of_node_put(node);
 		return;
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c
index 90db8a7..84dc543 100644
--- a/arch/powerpc/sysdev/tsi108_pci.c
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -434,7 +434,7 @@ void __init tsi108_pci_int_init(struct device_node *node)
 	DBG("Tsi108_pci_int_init: initializing PCI interrupts\n");
 
 	pci_irq_node = of_node_get(node);
-	pci_irq_host = irq_alloc_host(IRQ_HOST_MAP_LEGACY, 0, &pci_irq_host_ops, 0);
+	pci_irq_host = irq_alloc_host(IRQ_HOST_MAP_LEGACY, 0, &pci_irq_host_ops, 0, pci_irq_node->full_name);
 	if (pci_irq_host == NULL) {
 		printk(KERN_ERR "pci_irq_host: failed to allocate irq host !\n");
 		return;
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 8905989..7705676 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -247,7 +247,7 @@ static struct uic * __init uic_init_one(struct device_node *node)
 	uic->dcrbase = *dcrreg;
 
 	uic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, NR_UIC_INTS,
-				      &uic_host_ops, -1);
+				      &uic_host_ops, -1, node->full_name);
 	if (! uic->irqhost) {
 		of_node_put(node);
 		return NULL; /* FIXME: panic? */
-- 
1.5.1

Re: [PATCH 0/3] Add virq mapping debugfs for PowerPC

From: Stephen Rothwell <hidden>
Date: 2007-07-23 11:54:57

On Mon, 23 Jul 2007 19:13:47 +0800 Chen Gong [off-list ref] wrote:
[PATCH 1/3] Add a new member name to structure irq_host
[PATCH 2/3] Add irq host name for interrupt controllors
You should really combine patches 1 and 2 so that the tree will build and
run after each final commit in the git tree (so bisect works better).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2007-07-23 22:04:51

On Mon, 2007-07-23 at 19:13 +0800, Chen Gong wrote:
This patch adds a new member 'name' for irq host's name to
structure irq_host and modifies the definition of the
function irq_alloc_host(). The assignment to the
irq host's name is also added to irq_alloc_host().
I would instead prefer adding a irq_name callback to host, which would
return a per-irq name. In some cases, they could return the OF path to
the host for example.

Ben.
quoted hunk
Signed-off-by: Zhang Wei <redacted>
Signed-off-by: Chen Gong <redacted>
---
 arch/powerpc/kernel/irq.c |    4 +++-
 include/asm-powerpc/irq.h |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 2fc8786..2c46c6d 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -421,7 +421,8 @@ EXPORT_SYMBOL_GPL(virq_to_hw);
 struct irq_host *irq_alloc_host(unsigned int revmap_type,
 				unsigned int revmap_arg,
 				struct irq_host_ops *ops,
-				irq_hw_number_t inval_irq)
+				irq_hw_number_t inval_irq,
+				const char *name)
 {
 	struct irq_host *host;
 	unsigned int size = sizeof(struct irq_host);
@@ -446,6 +447,7 @@ struct irq_host *irq_alloc_host(unsigned int revmap_type,
 	host->revmap_type = revmap_type;
 	host->inval_irq = inval_irq;
 	host->ops = ops;
+	host->name = name;
 
 	spin_lock_irqsave(&irq_big_lock, flags);
 
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 0485c53..cd0ba2d 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -124,6 +124,7 @@ struct irq_host {
 	struct irq_host_ops	*ops;
 	void			*host_data;
 	irq_hw_number_t		inval_irq;
+	const char		*name;
 };
 
 /* The main irq map itself is an array of NR_IRQ entries containing the
@@ -159,7 +160,8 @@ extern irq_hw_number_t virq_to_hw(unsigned int virq);
 extern struct irq_host *irq_alloc_host(unsigned int revmap_type,
 				       unsigned int revmap_arg,
 				       struct irq_host_ops *ops,
-				       irq_hw_number_t inval_irq);
+				       irq_hw_number_t inval_irq,
+				       const char *name);
 

 /**

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Michael Ellerman <hidden>
Date: 2007-07-23 23:22:54

On Tue, 2007-07-24 at 08:04 +1000, Benjamin Herrenschmidt wrote:
On Mon, 2007-07-23 at 19:13 +0800, Chen Gong wrote:
quoted
This patch adds a new member 'name' for irq host's name to
structure irq_host and modifies the definition of the
function irq_alloc_host(). The assignment to the
irq host's name is also added to irq_alloc_host().
I would instead prefer adding a irq_name callback to host, which would
return a per-irq name. In some cases, they could return the OF path to
the host for example.
The pity is, for the 75% [1] of irq_hosts that have a device_node, they
will all have to implement the name callback, because they all store the
of node differently.

Which makes me think (again) that we should have an optional device_node
pointer in irq_host. I know you said you wanted the irq stuff to be OF
agnostic, but the reality is most of the implementations do have an OF
node. And all of the newer irq_host implementations do, with the
exception of PS3 and celleb - which are special.

cheers

[1] Yes I counted :)

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2007-07-23 23:36:30

On Tue, 2007-07-24 at 09:22 +1000, Michael Ellerman wrote:
On Tue, 2007-07-24 at 08:04 +1000, Benjamin Herrenschmidt wrote:
quoted
On Mon, 2007-07-23 at 19:13 +0800, Chen Gong wrote:
quoted
This patch adds a new member 'name' for irq host's name to
structure irq_host and modifies the definition of the
function irq_alloc_host(). The assignment to the
irq host's name is also added to irq_alloc_host().
I would instead prefer adding a irq_name callback to host, which would
return a per-irq name. In some cases, they could return the OF path to
the host for example.
The pity is, for the 75% [1] of irq_hosts that have a device_node, they
will all have to implement the name callback, because they all store the
of node differently.

Which makes me think (again) that we should have an optional device_node
pointer in irq_host. I know you said you wanted the irq stuff to be OF
agnostic, but the reality is most of the implementations do have an OF
node. And all of the newer irq_host implementations do, with the
exception of PS3 and celleb - which are special.
Won't work well in practice due to things like:

 - Cell iic -> one node per core, but one global host
 - xics -> one node per source controller (lots of them in the tree) but
one global host

Ben.

RE: [PATCH 1/3] Add a new member name to structure irq_host

From: Chen Gong-B11801 <hidden>
Date: 2007-07-24 04:06:38

Can you give me a DTS example or code segment? I'm ambiguous about
what you said.
-----Original Message-----
From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]=20
Sent: Tuesday, July 24, 2007 7:36 AM
To: michael@ellerman.id.au
Cc: Chen Gong-B11801; linuxppc-dev@ozlabs.org; paulus@samba.org
Subject: Re: [PATCH 1/3] Add a new member name to structure irq_host
=20
On Tue, 2007-07-24 at 09:22 +1000, Michael Ellerman wrote:
quoted
On Tue, 2007-07-24 at 08:04 +1000, Benjamin Herrenschmidt wrote:
quoted
On Mon, 2007-07-23 at 19:13 +0800, Chen Gong wrote:
quoted
This patch adds a new member 'name' for irq host's name to=20
structure irq_host and modifies the definition of the function=20
irq_alloc_host(). The assignment to the irq host's name is also=20
added to irq_alloc_host().
=20
I would instead prefer adding a irq_name callback to host, which=20
would return a per-irq name. In some cases, they could=20
return the OF=20
quoted
quoted
path to the host for example.
=20
The pity is, for the 75% [1] of irq_hosts that have a device_node,=20
they will all have to implement the name callback, because they all=20
store the of node differently.
=20
Which makes me think (again) that we should have an optional=20
device_node pointer in irq_host. I know you said you wanted the irq=20
stuff to be OF agnostic, but the reality is most of the=20
implementations do have an OF node. And all of the newer irq_host=20
implementations do, with the exception of PS3 and celleb -=20
which are special.
=20
Won't work well in practice due to things like:
=20
 - Cell iic -> one node per core, but one global host
 - xics -> one node per source controller (lots of them in=20
the tree) but one global host
=20
Ben.
=20
=20
=20

RE: [PATCH 1/3] Add a new member name to structure irq_host

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2007-07-24 04:33:36

On Tue, 2007-07-24 at 12:06 +0800, Chen Gong-B11801 wrote:
Can you give me a DTS example or code segment? I'm ambiguous about
what you said. 
Well, you would have to look at a cell blade or pSeries machine
device-tree, I don't have one at hand in DTS form... but basically,
those don't have a 1:1 relationship between hosts and nodes.

Anyway, I discussed with Michael today and it might be a good idea to
provide an optional device node field in the host struct that can be
used by the majority of the PICs that have one host == one node, that
would provide a good default for the name() function.

Ben.

RE: [PATCH 1/3] Add a new member name to structure irq_host

From: Zhang Wei-r63237 <hidden>
Date: 2007-07-24 09:25:38

Hi, Ben,=20

Thanks! Please see my inline comments.
=20
Well, you would have to look at a cell blade or pSeries machine
device-tree, I don't have one at hand in DTS form... but basically,
those don't have a 1:1 relationship between hosts and nodes.
Is there any problem when the relationship between hosts and nodes is
not 1:1?

The mapping method is defined in irq_alloc_host(). If there is only one
host for many nodes,
then these nodes will use the same mapping. Such as iic_host, the
IRQ_HOST_MAP_LINEAR
is used for its all nodes. We do _not_ care which node, we just care
which virq is mapped from which host's hw irq.
=20
Anyway, I discussed with Michael today and it might be a good idea to
provide an optional device node field in the host struct that can be
used by the majority of the PICs that have one host =3D=3D one node, =
that
would provide a good default for the name() function.
=20
But we have some irq host which has not OF-node bound.

Cheers!
Wei.

RE: [PATCH 1/3] Add a new member name to structure irq_host

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2007-07-24 09:36:59

On Tue, 2007-07-24 at 17:25 +0800, Zhang Wei-r63237 wrote:
Hi, Ben, 

Thanks! Please see my inline comments.
quoted
Well, you would have to look at a cell blade or pSeries machine
device-tree, I don't have one at hand in DTS form... but basically,
those don't have a 1:1 relationship between hosts and nodes.
Is there any problem when the relationship between hosts and nodes is
not 1:1?

The mapping method is defined in irq_alloc_host(). If there is only one
host for many nodes,
then these nodes will use the same mapping. Such as iic_host, the
IRQ_HOST_MAP_LINEAR
is used for its all nodes. We do _not_ care which node, we just care
which virq is mapped from which host's hw irq.
Sure and it all works fine, I was replying to the suggestion of adding a
device_node pointer in there.
quoted
Anyway, I discussed with Michael today and it might be a good idea to
provide an optional device node field in the host struct that can be
used by the majority of the PICs that have one host == one node, that
would provide a good default for the name() function.
But we have some irq host which has not OF-node bound.
Sure, hence the word 'optional' which would provide a default name.

Ben.

RE: [PATCH 1/3] Add a new member name to structure irq_host

From: Zhang Wei-r63237 <hidden>
Date: 2007-07-25 07:03:50

Hi, Ben,

Thanks!=20
Sure, hence the word 'optional' which would provide a default name.
=20
About the default name, since platforms we touched are very limited, we
do not know which name should be proper default name. We just assign
those default name to 'NULL'  for passing the compiling process. And the
platform maintain can correct it.

Cheers!
Wei.

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Segher Boessenkool <hidden>
Date: 2007-07-31 19:42:59

Which makes me think (again) that we should have an optional 
device_node
pointer in irq_host. I know you said you wanted the irq stuff to be OF
agnostic, but the reality is most of the implementations do have an OF
node. And all of the newer irq_host implementations do, with the
exception of PS3 and celleb - which are special.
How do you suggest to get a reasonable display name out of
the device tree?  The recommended human-readable name for
interrupt controller nodes is "interrupt-controller"...
You cannot use "device_type" either, and using "compatible"
requires selecting one of its string entries, and likely
using a lookup table after that, too.


Segher

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2007-07-31 21:44:41

On Tue, 2007-07-31 at 21:42 +0200, Segher Boessenkool wrote:
quoted
Which makes me think (again) that we should have an optional 
device_node
pointer in irq_host. I know you said you wanted the irq stuff to be OF
agnostic, but the reality is most of the implementations do have an OF
node. And all of the newer irq_host implementations do, with the
exception of PS3 and celleb - which are special.
How do you suggest to get a reasonable display name out of
the device tree?  The recommended human-readable name for
interrupt controller nodes is "interrupt-controller"...
You cannot use "device_type" either, and using "compatible"
requires selecting one of its string entries, and likely
using a lookup table after that, too.
In that case, I would display the node full path.

Ben.

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Segher Boessenkool <hidden>
Date: 2007-07-31 22:13:34

quoted
quoted
Which makes me think (again) that we should have an optional
device_node
pointer in irq_host. I know you said you wanted the irq stuff to be 
OF
agnostic, but the reality is most of the implementations do have an 
OF
node. And all of the newer irq_host implementations do, with the
exception of PS3 and celleb - which are special.
How do you suggest to get a reasonable display name out of
the device tree?  The recommended human-readable name for
interrupt controller nodes is "interrupt-controller"...
You cannot use "device_type" either, and using "compatible"
requires selecting one of its string entries, and likely
using a lookup table after that, too.
In that case, I would display the node full path.
Those tend to be quite long, in the cases where there are
multiple interrupt controllers in the system; and really
useless otherwise.  I think the interrupt controllers should
still just fill in the names "manually".

It's a good thing to have an of_node in the irq_host struct
anyway, though :-)


Segher

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Michael Ellerman <hidden>
Date: 2007-07-31 23:06:23

On Wed, 2007-08-01 at 00:13 +0200, Segher Boessenkool wrote:
quoted
quoted
quoted
Which makes me think (again) that we should have an optional
device_node
pointer in irq_host. I know you said you wanted the irq stuff to be 
OF
agnostic, but the reality is most of the implementations do have an 
OF
node. And all of the newer irq_host implementations do, with the
exception of PS3 and celleb - which are special.
How do you suggest to get a reasonable display name out of
the device tree?  The recommended human-readable name for
interrupt controller nodes is "interrupt-controller"...
You cannot use "device_type" either, and using "compatible"
requires selecting one of its string entries, and likely
using a lookup table after that, too.
In that case, I would display the node full path.
Those tend to be quite long, in the cases where there are
multiple interrupt controllers in the system; and really
useless otherwise.  I think the interrupt controllers should
still just fill in the names "manually".
They tend to be long, but they're unique, which is what you want, and
they're only for debugging anyway.
It's a good thing to have an of_node in the irq_host struct
anyway, though :-)
I posted patches for that last week.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Re: [PATCH 1/3] Add a new member name to structure irq_host

From: Segher Boessenkool <hidden>
Date: 2007-07-31 23:43:16

quoted
quoted
In that case, I would display the node full path.
Those tend to be quite long, in the cases where there are
multiple interrupt controllers in the system; and really
useless otherwise.  I think the interrupt controllers should
still just fill in the names "manually".
They tend to be long, but they're unique, which is what you want,
Yeah -- easy enough to add a sequence number to just about
anything though.
and they're only for debugging anyway.
Oh, I thought it would be used wherever the user gets told something
about the interrupt controller -- like when the interrupt tree would
be shown in sysfs (yes that's hypothetical still ;-) )
quoted
It's a good thing to have an of_node in the irq_host struct
anyway, though :-)
I posted patches for that last week.
I know, and thank you :-)


Segher
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help