aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/Kconfig.debug10
-rw-r--r--arch/powerpc/kernel/irq.c63
2 files changed, 73 insertions, 0 deletions
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 22acece95b11..c38bc2237057 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -124,6 +124,16 @@ config IRQSTACKS
124 for handling hard and soft interrupts. This can help avoid 124 for handling hard and soft interrupts. This can help avoid
125 overflowing the process kernel stacks. 125 overflowing the process kernel stacks.
126 126
127config VIRQ_DEBUG
128 bool "Expose hardware/virtual IRQ mapping via debugfs"
129 depends on DEBUG_FS && PPC_MERGE
130 help
131 This option will show the mapping relationship between hardware irq
132 numbers and virtual irq numbers. The mapping is exposed via debugfs
133 in the file powerpc/virq_mapping.
134
135 If you don't know what this means you don't need it.
136
127config BDI_SWITCH 137config BDI_SWITCH
128 bool "Include BDI-2000 user context switcher" 138 bool "Include BDI-2000 user context switcher"
129 depends on DEBUG_KERNEL && PPC32 139 depends on DEBUG_KERNEL && PPC32
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1339f32b44b5..0e47c8cfc979 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -52,6 +52,7 @@
52#include <linux/mutex.h> 52#include <linux/mutex.h>
53#include <linux/bootmem.h> 53#include <linux/bootmem.h>
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/debugfs.h>
55 56
56#include <asm/uaccess.h> 57#include <asm/uaccess.h>
57#include <asm/system.h> 58#include <asm/system.h>
@@ -1006,6 +1007,68 @@ static int irq_late_init(void)
1006} 1007}
1007arch_initcall(irq_late_init); 1008arch_initcall(irq_late_init);
1008 1009
1010#ifdef CONFIG_VIRQ_DEBUG
1011static int virq_debug_show(struct seq_file *m, void *private)
1012{
1013 unsigned long flags;
1014 irq_desc_t *desc;
1015 const char *p;
1016 char none[] = "none";
1017 int i;
1018
1019 seq_printf(m, "%-5s %-7s %-15s %s\n", "virq", "hwirq",
1020 "chip name", "host name");
1021
1022 for (i = 1; i < NR_IRQS; i++) {
1023 desc = get_irq_desc(i);
1024 spin_lock_irqsave(&desc->lock, flags);
1025
1026 if (desc->action && desc->action->handler) {
1027 seq_printf(m, "%5d ", i);
1028 seq_printf(m, "0x%05lx ", virq_to_hw(i));
1029
1030 if (desc->chip && desc->chip->typename)
1031 p = desc->chip->typename;
1032 else
1033 p = none;
1034 seq_printf(m, "%-15s ", p);
1035
1036 if (irq_map[i].host && irq_map[i].host->of_node)
1037 p = irq_map[i].host->of_node->full_name;
1038 else
1039 p = none;
1040 seq_printf(m, "%s\n", p);
1041 }
1042
1043 spin_unlock_irqrestore(&desc->lock, flags);
1044 }
1045
1046 return 0;
1047}
1048
1049static int virq_debug_open(struct inode *inode, struct file *file)
1050{
1051 return single_open(file, virq_debug_show, inode->i_private);
1052}
1053
1054static const struct file_operations virq_debug_fops = {
1055 .open = virq_debug_open,
1056 .read = seq_read,
1057 .llseek = seq_lseek,
1058 .release = single_release,
1059};
1060
1061static int __init irq_debugfs_init(void)
1062{
1063 if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root,
1064 NULL, &virq_debug_fops))
1065 return -ENOMEM;
1066
1067 return 0;
1068}
1069__initcall(irq_debugfs_init);
1070#endif /* CONFIG_VIRQ_DEBUG */
1071
1009#endif /* CONFIG_PPC_MERGE */ 1072#endif /* CONFIG_PPC_MERGE */
1010 1073
1011#ifdef CONFIG_PPC64 1074#ifdef CONFIG_PPC64