From: Geert Uytterhoeven <geert@linux-m68k.org>
To: linux-m68k@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH 13/28] m68k/irq: Add genirq support
Date: Sun, 11 Sep 2011 13:59:39 +0200 [thread overview]
Message-ID: <1315742394-16036-14-git-send-email-geert@linux-m68k.org> (raw)
In-Reply-To: <1315742394-16036-1-git-send-email-geert@linux-m68k.org>
Disabled on all platforms for now
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
[v1] Acked-by: Thomas Gleixner <tglx@linutronix.de>
---
v6:
- Keep irq_canonicalize(), which is needed for ac3200, atari_91C111,
serial_core, and 8250.
v5:
- Keep m68k_setup_auto_interrupt(), it's still needed for Q40
v3:
- Wrapper __m68k_handle_int() for do_IRQ() is no longer needed
- Use handle_simple_irq() instead of handle_level_irq(), which also
means we don't need the .irq_{,un}mask methods anymore, so they can
be removed again.
- Keep track of spurious interrupts
v2:
- Add missing "irq" offset in m68k_setup_irq_controller()
- Set up default handlers for autovector interrupts, and fill in missing
.irq_{,un}mask methods,
---
arch/m68k/Kconfig.mmu | 16 ++++++++++++
arch/m68k/include/asm/hardirq.h | 5 +++
arch/m68k/include/asm/irq.h | 35 +++++++++++++++++++++----
arch/m68k/kernel/Makefile_mm | 5 +++-
arch/m68k/kernel/ints.c | 52 ++++++++++++++++++++++++++++++++++++++-
5 files changed, 105 insertions(+), 8 deletions(-)
diff --git a/arch/m68k/Kconfig.mmu b/arch/m68k/Kconfig.mmu
index 4ef37c9..557b4b7 100644
--- a/arch/m68k/Kconfig.mmu
+++ b/arch/m68k/Kconfig.mmu
@@ -198,6 +198,22 @@ config SUN3
If you don't want to compile a kernel exclusively for a Sun 3, say N.
+config USE_GENERIC_HARDIRQS
+ bool "Use genirq"
+ depends on !AMIGA
+ depends on !ATARI
+ depends on !MAC
+ depends on !APOLLO
+ depends on !MVME147
+ depends on !MVME16x
+ depends on !BVME6000
+ depends on !HP300
+ depends on !SUN3X
+ depends on !Q40
+ depends on !SUN3
+ select HAVE_GENERIC_HARDIRQS
+ select GENERIC_IRQ_SHOW
+
config NATFEAT
bool "ARAnyM emulator support"
depends on ATARI
diff --git a/arch/m68k/include/asm/hardirq.h b/arch/m68k/include/asm/hardirq.h
index 870e534..db30ed2 100644
--- a/arch/m68k/include/asm/hardirq.h
+++ b/arch/m68k/include/asm/hardirq.h
@@ -18,6 +18,11 @@
#ifdef CONFIG_MMU
+static inline void ack_bad_irq(unsigned int irq)
+{
+ pr_crit("unexpected IRQ trap at vector %02x\n", irq);
+}
+
/* entry.S is sensitive to the offsets of these fields */
typedef struct {
unsigned int __softirq_pending;
diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h
index fe625e2..8971647 100644
--- a/arch/m68k/include/asm/irq.h
+++ b/arch/m68k/include/asm/irq.h
@@ -27,11 +27,6 @@
#ifdef CONFIG_MMU
-#include <linux/linkage.h>
-#include <linux/hardirq.h>
-#include <linux/irqreturn.h>
-#include <linux/spinlock_types.h>
-
/*
* Interrupt source definitions
* General interrupt sources are the level 1-7.
@@ -54,7 +49,12 @@
#define IRQ_USER 8
-extern unsigned int irq_canonicalize(unsigned int irq);
+#ifndef CONFIG_GENERIC_HARDIRQS
+
+#include <linux/linkage.h>
+#include <linux/hardirq.h>
+#include <linux/irqreturn.h>
+#include <linux/spinlock_types.h>
struct pt_regs;
@@ -108,10 +108,33 @@ extern void m68k_setup_irq_chip(struct irq_chip *, unsigned int, unsigned int);
extern void generic_handle_irq(unsigned int);
asmlinkage void do_IRQ(int irq, struct pt_regs *regs);
+#else /* CONFIG_GENERIC_HARDIRQS */
+
+struct irq_data;
+struct irq_chip;
+struct irq_desc;
+extern unsigned int m68k_irq_startup(struct irq_data *data);
+extern unsigned int m68k_irq_startup_irq(unsigned int irq);
+extern void m68k_irq_shutdown(struct irq_data *data);
+extern void m68k_setup_auto_interrupt(void (*handler)(unsigned int,
+ struct pt_regs *));
+extern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
+ void (*handler)(unsigned int,
+ struct pt_regs *));
+extern void m68k_setup_irq_controller(struct irq_chip *,
+ void (*handle)(unsigned int irq,
+ struct irq_desc *desc),
+ unsigned int irq, unsigned int cnt);
+
+#endif /* CONFIG_GENERIC_HARDIRQS */
+
+extern unsigned int irq_canonicalize(unsigned int irq);
+
#else
#define irq_canonicalize(irq) (irq)
#endif /* CONFIG_MMU */
asmlinkage void do_IRQ(int irq, struct pt_regs *regs);
+extern atomic_t irq_err_count;
#endif /* _M68K_IRQ_H_ */
diff --git a/arch/m68k/kernel/Makefile_mm b/arch/m68k/kernel/Makefile_mm
index aced678..8122750 100644
--- a/arch/m68k/kernel/Makefile_mm
+++ b/arch/m68k/kernel/Makefile_mm
@@ -10,8 +10,11 @@ endif
extra-y += vmlinux.lds
obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \
- sys_m68k.o time.o setup.o m68k_ksyms.o devres.o syscalltable.o
+ sys_m68k.o time.o setup.o m68k_ksyms.o syscalltable.o
devres-y = ../../../kernel/irq/devres.o
obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
+
+obj-y$(CONFIG_GENERIC_HARDIRQS) += devres.o
+obj-$(CONFIG_GENERIC_HARDIRQS) += irq.o
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index f6a4698..cea439f 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -31,6 +31,7 @@ extern u32 auto_irqhandler_fixup[];
extern u32 user_irqhandler_fixup[];
extern u16 user_irqvec_fixup[];
+#ifndef CONFIG_GENERIC_HARDIRQS
/* table for system interrupt handlers */
static struct irq_data *irq_list[NR_IRQS];
static struct irq_chip *irq_chip[NR_IRQS];
@@ -41,6 +42,8 @@ static inline int irq_set_chip(unsigned int irq, struct irq_chip *chip)
irq_chip[irq] = chip;
return 0;
}
+#define irq_set_chip_and_handler(irq, chip, dummy) irq_set_chip(irq, chip)
+#endif /* !CONFIG_GENERIC_HARDIRQS */
static int m68k_first_user_vec;
@@ -56,8 +59,10 @@ static struct irq_chip user_irq_chip = {
.irq_shutdown = m68k_irq_shutdown,
};
+#ifndef CONFIG_GENERIC_HARDIRQS
#define NUM_IRQ_NODES 100
static struct irq_data nodes[NUM_IRQ_NODES];
+#endif /* !CONFIG_GENERIC_HARDIRQS */
/*
* void init_IRQ(void)
@@ -81,7 +86,7 @@ void __init init_IRQ(void)
}
for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
- irq_set_chip(i, &auto_irq_chip);
+ irq_set_chip_and_handler(i, &auto_irq_chip, handle_simple_irq);
mach_init_IRQ();
}
@@ -128,6 +133,35 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
flush_icache();
}
+#ifdef CONFIG_GENERIC_HARDIRQS
+
+/**
+ * m68k_setup_irq_controller
+ * @chip: irq chip which controls specified irq
+ * @handle: flow handler which handles specified irq
+ * @irq: first irq to be managed by the controller
+ * @cnt: number of irqs to be managed by the controller
+ *
+ * Change the controller for the specified range of irq, which will be used to
+ * manage these irq. auto/user irq already have a default controller, which can
+ * be changed as well, but the controller probably should use m68k_irq_startup/
+ * m68k_irq_shutdown.
+ */
+void m68k_setup_irq_controller(struct irq_chip *chip,
+ irq_flow_handler_t handle, unsigned int irq,
+ unsigned int cnt)
+{
+ int i;
+
+ for (i = 0; i < cnt; i++) {
+ irq_set_chip(irq + i, chip);
+ if (handle)
+ irq_set_handler(irq + i, handle);
+ }
+}
+
+#else /* !CONFIG_GENERIC_HARDIRQS */
+
/**
* m68k_setup_irq_chip
* @contr: irq controller which controls specified irq
@@ -316,6 +350,8 @@ void disable_irq_nosync(unsigned int irq) __attribute__((alias("disable_irq")));
EXPORT_SYMBOL(disable_irq_nosync);
+#endif /* !CONFIG_GENERIC_HARDIRQS */
+
unsigned int m68k_irq_startup_irq(unsigned int irq)
{
if (irq <= IRQ_AUTO_7)
@@ -341,6 +377,8 @@ void m68k_irq_shutdown(struct irq_data *data)
}
+#ifndef CONFIG_GENERIC_HARDIRQS
+
/*
* Do we need these probe functions on the m68k?
*
@@ -367,6 +405,7 @@ int probe_irq_off (unsigned long irqs)
}
EXPORT_SYMBOL(probe_irq_off);
+#endif /* CONFIG_GENERIC_HARDIRQS */
unsigned int irq_canonicalize(unsigned int irq)
{
@@ -379,6 +418,7 @@ unsigned int irq_canonicalize(unsigned int irq)
EXPORT_SYMBOL(irq_canonicalize);
+#ifndef CONFIG_GENERIC_HARDIRQS
void generic_handle_irq(unsigned int irq)
{
struct irq_data *node;
@@ -428,3 +468,13 @@ void init_irq_proc(void)
/* Insert /proc/irq driver here */
}
#endif
+
+#else /* CONFIG_GENERIC_HARDIRQS */
+
+asmlinkage void handle_badint(struct pt_regs *regs)
+{
+ atomic_inc(&irq_err_count);
+ pr_warn("unexpected interrupt from %u\n", regs->vector);
+}
+
+#endif /* CONFIG_GENERIC_HARDIRQS */
--
1.7.0.4
next prev parent reply other threads:[~2011-09-11 12:03 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-11 11:59 [PATCH 00/28 v6] m68k: Convert to genirq Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 01/28] genirq: Add missing "else" in irq_shutdown() Geert Uytterhoeven
2011-09-12 7:53 ` Thomas Gleixner
2011-09-11 11:59 ` [PATCH 02/28] ide-{cd,floppy,tape}: Do not include <linux/irq.> Geert Uytterhoeven
2011-09-12 9:59 ` Sergei Shtylyov
2011-09-11 11:59 ` [PATCH 03/28] keyboard: " Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 04/28] m68k/irq: Rename irq_controller to irq_chip Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 05/28] m68k/irq: Kill irq_node_t typedef, always use struct irq_node Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 06/28] m68k/irq: Rename irq_node to irq_data Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 07/28] m68k/irq: Switch irq_chip methods to "struct irq_data *data" Geert Uytterhoeven
2011-09-11 13:40 ` Finn Thain
2011-09-11 17:46 ` Geert Uytterhoeven
2011-09-12 2:48 ` Finn Thain
2011-09-11 11:59 ` [PATCH 08/28] m68k/irq: Rename setup_irq() to m68k_setup_irq() and make it static Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 09/28] m68k/irq: Extract irq_set_chip() Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 10/28] m68k/irq: Add m68k_setup_irq_controller() Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 11/28] m68k/irq: Rename {,__}m68k_handle_int() Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 12/28] m68k/irq: Remove obsolete IRQ_FLG_* definitions and users Geert Uytterhoeven
2011-09-11 11:59 ` Geert Uytterhoeven [this message]
2011-09-11 11:59 ` [PATCH 14/28] m68k/atari: Convert Atari to genirq Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 15/28] m68k/atari: Remove code and comments about different irq types Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 16/28] m68k/amiga: Refactor amiints.c Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 17/28] m68k/amiga: Convert Amiga to genirq Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 18/28] m68k/amiga: Optimize interrupts using chain handlers Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 19/28] m68k/mac: Convert Mac to genirq Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 20/28] m68k/mac: Optimize interrupts using chain handlers Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 21/28] m68k/hp300: Convert HP9000/300 and HP9000/400 to genirq Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 22/28] m68k/vme: Convert VME " Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 23/28] m68k/apollo: Convert Apollo " Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 24/28] m68k/sun3: Use the kstat_irqs_cpu() wrapper Geert Uytterhoeven
2011-09-12 17:38 ` Sam Creasey
2011-09-11 11:59 ` [PATCH 25/28] m68k/sun3: Convert Sun3/3x to genirq Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 26/28] m68k/q40: Convert Q40/Q60 " Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 27/28] m68k/irq: Remove obsolete m68k irq framework Geert Uytterhoeven
2011-09-11 11:59 ` [PATCH 28/28] m68k/irq: Remove obsolete support for user vector interrupt fixups Geert Uytterhoeven
2011-09-13 11:11 ` [PATCH 00/28 v6] m68k: Convert to genirq Finn Thain
2011-09-13 11:18 ` Geert Uytterhoeven
2011-09-13 17:26 ` Finn Thain
2011-10-20 12:18 ` Geert Uytterhoeven
2011-10-20 13:40 ` Finn Thain
2011-10-20 15:02 ` Geert Uytterhoeven
2011-10-20 16:03 ` Geert Uytterhoeven
2011-10-20 23:30 ` Finn Thain
2011-10-23 9:49 ` Geert Uytterhoeven
2011-10-23 11:29 ` Greg Ungerer
2011-10-23 12:12 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1315742394-16036-14-git-send-email-geert@linux-m68k.org \
--to=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®