All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Add a new member 'name' to structure irq_host.
@ 2007-03-16  4:38 Zhang Wei
  2007-03-16  4:38 ` [PATCH 2/4] Add i8259 host name Zhang Wei
  0 siblings, 1 reply; 10+ messages in thread
From: Zhang Wei @ 2007-03-16  4:38 UTC (permalink / raw)
  To: paulus, benh, galak; +Cc: linuxppc-dev, r54964

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 <wei.zhang@freescale.com>
---
 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 919fbf5..2cbf87f 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -404,7 +404,8 @@ static struct irq_host *irq_default_host
 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);
@@ -429,6 +430,7 @@ struct irq_host *irq_alloc_host(unsigned
 	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 cf927c1..d8d77ef 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -124,6 +124,7 @@ #define IRQ_HOST_MAP_TREE	3 /* radix tre
 	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
@@ -162,7 +163,8 @@ static inline irq_hw_number_t virq_to_hw
 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.4.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] Add i8259 host name.
  2007-03-16  4:38 [PATCH 1/4] Add a new member 'name' to structure irq_host Zhang Wei
@ 2007-03-16  4:38 ` Zhang Wei
  2007-03-16  4:38   ` [PATCH 3/4] Add mpic " Zhang Wei
  0 siblings, 1 reply; 10+ messages in thread
From: Zhang Wei @ 2007-03-16  4:38 UTC (permalink / raw)
  To: paulus, benh, galak; +Cc: linuxppc-dev, r54964

This patch adds i8259 irq controller host name by the i8259 of_node's full name.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/sysdev/i8259.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

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
 	/* 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;
-- 
1.4.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] Add mpic host name.
  2007-03-16  4:38 ` [PATCH 2/4] Add i8259 host name Zhang Wei
@ 2007-03-16  4:38   ` Zhang Wei
  2007-03-16  4:38     ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list Zhang Wei
  0 siblings, 1 reply; 10+ messages in thread
From: Zhang Wei @ 2007-03-16  4:38 UTC (permalink / raw)
  To: paulus, benh, galak; +Cc: linuxppc-dev, r54964

This patch adds mpic controller host name by the mpic of_node's full_name.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/sysdev/mpic.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index bcfb900..4e1581e 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -926,7 +926,8 @@ struct mpic * __init mpic_alloc(struct d
 
 	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;
-- 
1.4.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list.
  2007-03-16  4:38   ` [PATCH 3/4] Add mpic " Zhang Wei
@ 2007-03-16  4:38     ` Zhang Wei
  2007-03-20  3:03       ` Michael Ellerman
  0 siblings, 1 reply; 10+ messages in thread
From: Zhang Wei @ 2007-03-16  4:38 UTC (permalink / raw)
  To: paulus, benh, galak; +Cc: linuxppc-dev, r54964

This patch adds 'irq' directory into the root debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/kernel/Makefile      |    1 
 arch/powerpc/kernel/irq_debugfs.c |  135 +++++++++++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 8120d42..9c56acd 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -14,6 +14,7 @@ obj-y				:= semaphore.o cputable.o ptrac
 				   irq.o align.o signal_32.o pmc.o vdso.o \
 				   init_task.o process.o systbl.o idle.o
 obj-y				+= vdso32/
+obj-$(CONFIG_DEBUG_FS)		+= 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..246bdce
--- /dev/null
+++ b/arch/powerpc/kernel/irq_debugfs.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: Zhang Wei <wei.zhang@freescale.com>
+ *
+ * Description:
+ * This file is used for debug the irq. It will create 'irq' directory
+ * in the root 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>
+
+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;
+
+	irq_root = debugfs_create_dir("irq", NULL);
+	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.4.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list.
  2007-03-16  4:38     ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list Zhang Wei
@ 2007-03-20  3:03       ` Michael Ellerman
  2007-03-20  9:51         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting thevirq " Zhang Wei-r63237
  2007-03-21 14:17         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq " Segher Boessenkool
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Ellerman @ 2007-03-20  3:03 UTC (permalink / raw)
  To: Zhang Wei; +Cc: paulus, r54964, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

On Fri, 2007-03-16 at 12:38 +0800, Zhang Wei wrote:
> This patch adds 'irq' directory into the root debugfs and virq_mapping for getting the virq to
> irq host's hwirq mapping list.

Minor nit. Should we be creating a 'powerpc' directory first, and
putting the 'irq' file under that? Otherwise we risk clashing with some
generic code that creates a file called 'irq' in debugfs.

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 4/4] Add irq debugfs and virq_mapping for getting thevirq to irq host's hwirq mapping list.
  2007-03-20  3:03       ` Michael Ellerman
@ 2007-03-20  9:51         ` Zhang Wei-r63237
  2007-03-27  3:21           ` Michael Ellerman
  2007-03-21 14:17         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq " Segher Boessenkool
  1 sibling, 1 reply; 10+ messages in thread
From: Zhang Wei-r63237 @ 2007-03-20  9:51 UTC (permalink / raw)
  To: michael; +Cc: Wang Haiying-r54964, paulus, linuxppc-dev


>=20
> Minor nit. Should we be creating a 'powerpc' directory first, and
> putting the 'irq' file under that? Otherwise we risk clashing=20
> with some
> generic code that creates a file called 'irq' in debugfs.
>=20
> cheers
>=20
Hi, Michael,

I've seen some codes in arch/powerpc/kernel/prom.c to create debugfs dir =
"powerpc". But those codes were enabled by a local macro 'DEBUG'. There =
is a little problem. Maybe I should change '#ifdef DEBUG' to '#ifdef =
CONFIG_DEBUG_FS' before the export_flat_device_tree() function in =
arch/powerpc/kernel/prom.c. How about it?

Thanks!

Best Regards
Zhang Wei

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list.
  2007-03-20  3:03       ` Michael Ellerman
  2007-03-20  9:51         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting thevirq " Zhang Wei-r63237
@ 2007-03-21 14:17         ` Segher Boessenkool
  2007-03-21 20:24           ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 10+ messages in thread
From: Segher Boessenkool @ 2007-03-21 14:17 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, paulus, r54964

>> This patch adds 'irq' directory into the root debugfs and 
>> virq_mapping for getting the virq to
>> irq host's hwirq mapping list.
>
> Minor nit. Should we be creating a 'powerpc' directory first, and
> putting the 'irq' file under that? Otherwise we risk clashing with some
> generic code that creates a file called 'irq' in debugfs.

Or put the whole IRQ tree under sysfs generically...


Segher

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list.
  2007-03-21 14:17         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq " Segher Boessenkool
@ 2007-03-21 20:24           ` Benjamin Herrenschmidt
  2007-03-21 21:45             ` Segher Boessenkool
  0 siblings, 1 reply; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-03-21 20:24 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, paulus, r54964

On Wed, 2007-03-21 at 15:17 +0100, Segher Boessenkool wrote:
> >> This patch adds 'irq' directory into the root debugfs and 
> >> virq_mapping for getting the virq to
> >> irq host's hwirq mapping list.
> >
> > Minor nit. Should we be creating a 'powerpc' directory first, and
> > putting the 'irq' file under that? Otherwise we risk clashing with some
> > generic code that creates a file called 'irq' in debugfs.
> 
> Or put the whole IRQ tree under sysfs generically...

Except that there is no such thing as an IRQ tree in the generic code...

Ben.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list.
  2007-03-21 20:24           ` Benjamin Herrenschmidt
@ 2007-03-21 21:45             ` Segher Boessenkool
  0 siblings, 0 replies; 10+ messages in thread
From: Segher Boessenkool @ 2007-03-21 21:45 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus, r54964

>> Or put the whole IRQ tree under sysfs generically...
>
> Except that there is no such thing as an IRQ tree in the generic 
> code...

Darn, I thought the whole cascading thing was done in
generic code now.  Oh well...


Segher

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 4/4] Add irq debugfs and virq_mapping for getting thevirq to irq host's hwirq mapping list.
  2007-03-20  9:51         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting thevirq " Zhang Wei-r63237
@ 2007-03-27  3:21           ` Michael Ellerman
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2007-03-27  3:21 UTC (permalink / raw)
  To: Zhang Wei-r63237; +Cc: Wang Haiying-r54964, paulus, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

On Tue, 2007-03-20 at 17:51 +0800, Zhang Wei-r63237 wrote:
> > 
> > Minor nit. Should we be creating a 'powerpc' directory first, and
> > putting the 'irq' file under that? Otherwise we risk clashing 
> > with some
> > generic code that creates a file called 'irq' in debugfs.
> > 
> > cheers
> > 
> Hi, Michael,
> 
> I've seen some codes in arch/powerpc/kernel/prom.c to create debugfs
> dir "powerpc". But those codes were enabled by a local macro 'DEBUG'.
> There is a little problem. Maybe I should change '#ifdef DEBUG' to
> '#ifdef CONFIG_DEBUG_FS' before the export_flat_device_tree() function
> in arch/powerpc/kernel/prom.c. How about it?

No, we don't want to always export the flat device tree.

Instead I think you should add a function in
arch/powerpc/kernel/setup-common.c which creates the powerpc directory
if CONFIG_DEBUG_FS is enabled, make it an arch_initcall. Then the flat
device tree code can use that directory, and so can your irq stuff.

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-03-27  3:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-16  4:38 [PATCH 1/4] Add a new member 'name' to structure irq_host Zhang Wei
2007-03-16  4:38 ` [PATCH 2/4] Add i8259 host name Zhang Wei
2007-03-16  4:38   ` [PATCH 3/4] Add mpic " Zhang Wei
2007-03-16  4:38     ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq to irq host's hwirq mapping list Zhang Wei
2007-03-20  3:03       ` Michael Ellerman
2007-03-20  9:51         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting thevirq " Zhang Wei-r63237
2007-03-27  3:21           ` Michael Ellerman
2007-03-21 14:17         ` [PATCH 4/4] Add irq debugfs and virq_mapping for getting the virq " Segher Boessenkool
2007-03-21 20:24           ` Benjamin Herrenschmidt
2007-03-21 21:45             ` Segher Boessenkool

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.