Skip to contentSkip to conversation

Add virq mapping debugfs for PowerPC

PATCH In review Chen Gong 6 participants 18 messages Jul 23, 2007 – Jul 31, 2007

Subsystems (5)
lore
Share & tools
lore
author
#1 lore raw

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

In reply to Chen Gong

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().

---
 arch/powerpc/kernel/irq.c |    4 +++-
 include/asm-powerpc/irq.h |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/irq.c +3 -1
index 2fc8786..2c46c6d 100644
@@ -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);
 
include/asm-powerpc/irq.h +3 -1
index 0485c53..cd0ba2d 100644
@@ -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);
 
 
 /**
Signature · 1 line
1.5.1
author
#2 lore raw

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

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.

---
 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(-)
arch/powerpc/platforms/52xx/mpc52xx_pic.c +1 -1
index fbfff95..d5efdbc 100644
@@ -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");
arch/powerpc/platforms/82xx/mpc82xx_ads.c +1 -1
index da20832..3e27d3d 100644
@@ -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;
 }
 
arch/powerpc/platforms/cell/interrupt.c +1 -1
index 47264e7..9768ba2 100644
@@ -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);
 
arch/powerpc/platforms/cell/spider-pic.c +1 -1
index 05f4b3d..79c8d4f 100644
@@ -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;
arch/powerpc/platforms/celleb/interrupt.c +1 -1
index 98e6665..0a08a99 100644
@@ -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);
 }
arch/powerpc/platforms/iseries/irq.c +1 -1
index 63b3367..766f5d3 100644
@@ -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);
 
arch/powerpc/platforms/powermac/pic.c +1 -1
index 87cd680..9d4b3e1 100644
@@ -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);
 
arch/powerpc/platforms/ps3/interrupt.c +1 -1
index 67e32ec..2b56b81 100644
@@ -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);
 
arch/powerpc/platforms/pseries/xics.c +1 -1
index 5bd90a7..7f8a5c7 100644
@@ -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);
 }
arch/powerpc/sysdev/commproc.c +2 -1
index 4f67b89..91dc738 100644
@@ -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;
arch/powerpc/sysdev/cpm2_pic.c +1 -1
index eabfe06..1aaebf8 100644
@@ -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;
arch/powerpc/sysdev/i8259.c +2 -1
index ad87adc..e80c127 100644
@@ -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;
arch/powerpc/sysdev/ipic.c +2 -1
index 473c415..4fe6770 100644
@@ -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;
arch/powerpc/sysdev/mpc8xx_pic.c +1 -1
index 2fc2bcd..c3eb805 100644
@@ -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;
arch/powerpc/sysdev/mpic.c +2 -1
index 74c64c0..d71441e 100644
@@ -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;
arch/powerpc/sysdev/mv64x60_pic.c +2 -1
index 01d3162..2bb5b12 100644
@@ -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;
 
arch/powerpc/sysdev/qe_lib/qe_ic.c +2 -1
index 4d1dcb4..1e78a02 100644
@@ -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;
arch/powerpc/sysdev/tsi108_pci.c +1 -1
index 90db8a7..84dc543 100644
@@ -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;
arch/powerpc/sysdev/uic.c +1 -1
index 8905989..7705676 100644
@@ -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? */
Signature · 1 line
1.5.1
author
#3 lore raw

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

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.

---
 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
arch/powerpc/Kconfig.debug +7 -0
index 346cd3b..7ae8df1 100644
@@ -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
arch/powerpc/kernel/Makefile +1 -0
index 42c42ec..cc3e1e5 100644
@@ -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 \
arch/powerpc/kernel/irq_debugfs.c new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
1.5.1

Chen Gong

author
#0 lore raw

cover Add virq mapping debugfs for PowerPC

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

#17 lore raw
Quoted 3 lines · On Mon, 23 Jul 2007 19:13:47 +0800 Chen Gong <[email protected]> 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).

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#4 lore raw

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

In reply to Chen Gong
Quoted 4 lines · Chen Gong

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 51 lines
---
 arch/powerpc/kernel/irq.c |    4 +++-
 include/asm-powerpc/irq.h |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/irq.c +3 -1
index 2fc8786..2c46c6d 100644
@@ -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);
 
include/asm-powerpc/irq.h +3 -1
index 0485c53..cd0ba2d 100644
@@ -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);
 
 
 /**
#5 lore raw

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

Quoted 9 lines · Benjamin Herrenschmidt
Quoted 4 lines · Chen Gong

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 :)

Signature · 8 lines
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
#6 lore raw

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

Quoted 15 lines · Michael Ellerman
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 4 lines · Chen Gong

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.

Quoted 5 lines

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.

#7 lore raw

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

Can you give me a DTS example or code segment? I'm ambiguous about what you said.

Quoted 41 lines

-----Original Message-----
From: Benjamin Herrenschmidt [mailto:[email protected]]=20
Sent: Tuesday, July 24, 2007 7:36 AM
To: [email protected]
Cc: Chen Gong-B11801; [email protected]; [email protected]
Subject: Re: [PATCH 1/3] Add a new member name to structure irq_host =20

Quoted 9 lines · Michael Ellerman
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines · Chen Gong

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 11 lines
Quoted 1 line

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

#8 lore raw

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

Quoted 2 lines · 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.

#9 lore raw

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

Hi, Ben,=20

Thanks! Please see my inline comments.

Quoted 4 lines

=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.

Quoted 4 lines

=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

Quoted 2 lines

would provide a good default for the name() function. =20

But we have some irq host which has not OF-node bound.

Cheers!
Wei.

#10 lore raw

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

Quoted 12 lines · On Tue, 2007-07-24 at 17:25 +0800, Zhang Wei-r63237 wrote:

Hi, Ben,

Thanks! Please see my inline comments.

Quoted 4 lines

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?

Quoted 6 lines

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 8 lines
Quoted 6 lines

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.

#11 lore raw

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

Hi, Ben,

Thanks!=20

Quoted 2 lines

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.

#12 lore raw

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

In reply to Michael Ellerman
Quoted 5 lines

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

#13 lore raw

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

Quoted 7 lines · Segher Boessenkool
Quoted 6 lines

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.

Quoted 6 lines

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.

#14 lore raw

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

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

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.

Quoted 8 lines
Quoted 6 lines

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

#15 lore raw

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

Quoted 16 lines · Segher Boessenkool
Quoted 16 lines
Quoted 15 lines
Quoted 8 lines

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.

Quoted 6 lines
Quoted 1 line

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.

Quoted 2 lines

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

Signature · 8 lines
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
#16 lore raw

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

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

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.

Quoted 1 line

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 4 lines
Quoted 2 lines

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