[PATCH] add {request,free}_virt_irq() helper functions

Nishanth Aravamudan nacc at us.ibm.com
Wed Aug 10 09:29:43 EST 2005


Hi,

Description: For drivers which do not actually have access to
interrupts, it is useful to be able to request a virtual IRQ on PPC.
Provide wrapper functions for the request and free paths. One user of
this interface is the IBM eHCA Driver (Infiniband Host Channel Adapter)
which has been submitted to the OpenIB tree.

Signed-off-by: Nishanth Aravamudan <nacc at us.ibm.com>

---

 arch/ppc64/kernel/irq.c  |   33 +++++++++++++++++++++++++++++++++
 include/asm-ppc64/virq.h |   30 ++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)

diff -urpN 2.6.13-rc6/arch/ppc64/kernel/irq.c 2.6.13-rc6-dev/arch/ppc64/kernel/irq.c
--- 2.6.13-rc6/arch/ppc64/kernel/irq.c	2005-08-09 15:22:54.000000000 -0700
+++ 2.6.13-rc6-dev/arch/ppc64/kernel/irq.c	2005-08-09 16:28:27.000000000 -0700
@@ -49,6 +49,7 @@
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
+#include <asm/virq.h>
 #include <asm/cache.h>
 #include <asm/prom.h>
 #include <asm/ptrace.h>
@@ -462,6 +463,38 @@ unsigned int real_irq_to_virt_slowpath(u
 
 }
 
+/*
+ * Wrapper around request_irq to allow registering handler for
+ * a specific Interrupt Source Token ist
+ */
+int request_virt_irq(__u32 ist, 
+		     irqreturn_t (*handler)(int, void*, struct pt_regs *),
+		     unsigned long irq_flags, const char * devname,
+		     void *dev_id)
+{
+	unsigned int irq = virt_irq_create_mapping(ist);
+	if (irq == NO_IRQ)
+		return -EINVAL;
+
+	irq = irq_offset_up(irq);
+	return request_irq(irq, handler,
+			   irq_flags, devname, dev_id);
+}
+EXPORT_SYMBOL_GPL(request_virt_irq);
+
+/*
+ * Wrapper around free_irq to allow deregistering handler for
+ * a specific Interrupt Source Token ist
+ */
+void free_virt_irq(__u32 ist, void *dev_id)
+{
+	unsigned int irq = virt_irq_create_mapping(ist);
+	
+	irq = irq_offset_up(irq);
+	free_irq(irq, dev_id);
+	return;
+}
+EXPORT_SYMBOL_GPL(free_virt_irq);
 #endif /* CONFIG_PPC_ISERIES */
 
 #ifdef CONFIG_IRQSTACKS
diff -urpN 2.6.13-rc6/include/asm-ppc64/virq.h 2.6.13-rc6-dev/include/asm-ppc64/virq.h
--- 2.6.13-rc6/include/asm-ppc64/virq.h	1969-12-31 16:00:00.000000000 -0800
+++ 2.6.13-rc6-dev/include/asm-ppc64/virq.h	2005-08-09 15:23:17.000000000 -0700
@@ -0,0 +1,30 @@
+#ifdef __KERNEL__
+#ifndef _ASM_VIRQ_H
+#define _ASM_VIRQ_H
+
+/*
+ * 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/config.h>
+#include <linux/interrupt.h>
+
+/*
+ * Wrapper around request_irq to allow registering handler for
+ * a specific Interrupt Source Token ist
+ */
+int request_virt_irq(__u32 ist, 
+		     irqreturn_t (*handler)(int, void*, struct pt_regs *),
+		     unsigned long irq_flags, const char * devname,
+		     void *dev_id);
+/*
+ * Wrapper around free_irq to allow deregistering handler for
+ * a specific Interrupt Source Token ist
+ */
+void free_virt_irq(__u32 ist, void *dev_id);
+
+#endif /* _ASM_VIRQ_H */
+#endif /* __KERNEL__ */



More information about the Linuxppc64-dev mailing list