Skip to content

Commit 4936f63

Browse files
committed
m68k/irq: Add genirq support
Disabled on all platforms for now Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> [v1] Acked-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 5a23945 commit 4936f63

5 files changed

Lines changed: 112 additions & 12 deletions

File tree

‎arch/m68k/Kconfig‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,23 @@ config MMU_SUN3
8484
bool
8585
depends on MMU && !MMU_MOTOROLA
8686

87+
config USE_GENERIC_HARDIRQS
88+
bool "Use genirq"
89+
depends on MMU
90+
depends on !AMIGA
91+
depends on !ATARI
92+
depends on !MAC
93+
depends on !APOLLO
94+
depends on !MVME147
95+
depends on !MVME16x
96+
depends on !BVME6000
97+
depends on !HP300
98+
depends on !SUN3X
99+
depends on !Q40
100+
depends on !SUN3
101+
select HAVE_GENERIC_HARDIRQS
102+
select GENERIC_IRQ_SHOW
103+
87104
menu "Platform setup"
88105

89106
source arch/m68k/Kconfig.cpu

‎arch/m68k/include/asm/hardirq.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
#ifdef CONFIG_MMU
2020

21+
static inline void ack_bad_irq(unsigned int irq)
22+
{
23+
pr_crit("unexpected IRQ trap at vector %02x\n", irq);
24+
}
25+
2126
/* entry.S is sensitive to the offsets of these fields */
2227
typedef struct {
2328
unsigned int __softirq_pending;

‎arch/m68k/include/asm/irq.h‎

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727

2828
#ifdef CONFIG_MMU
2929

30-
#include <linux/linkage.h>
31-
#include <linux/hardirq.h>
32-
#include <linux/irqreturn.h>
33-
#include <linux/spinlock_types.h>
34-
3530
/*
3631
* Interrupt source definitions
3732
* General interrupt sources are the level 1-7.
@@ -54,10 +49,6 @@
5449

5550
#define IRQ_USER 8
5651

57-
extern unsigned int irq_canonicalize(unsigned int irq);
58-
59-
struct pt_regs;
60-
6152
/*
6253
* various flags for request_irq() - the Amiga now uses the standard
6354
* mechanism like all other architectures - IRQF_DISABLED and
@@ -71,6 +62,15 @@ struct pt_regs;
7162
#define IRQ_FLG_STD (0x8000) /* internally used */
7263
#endif
7364

65+
#ifndef CONFIG_GENERIC_HARDIRQS
66+
67+
#include <linux/linkage.h>
68+
#include <linux/hardirq.h>
69+
#include <linux/irqreturn.h>
70+
#include <linux/spinlock_types.h>
71+
72+
struct pt_regs;
73+
7474
/*
7575
* This structure is used to chain together the ISRs for a particular
7676
* interrupt source (if it supports chaining).
@@ -121,10 +121,33 @@ extern void m68k_setup_irq_chip(struct irq_chip *, unsigned int, unsigned int);
121121
extern void generic_handle_irq(unsigned int);
122122
asmlinkage void do_IRQ(int irq, struct pt_regs *regs);
123123

124+
#else /* CONFIG_GENERIC_HARDIRQS */
125+
126+
struct irq_data;
127+
struct irq_chip;
128+
struct irq_desc;
129+
extern unsigned int m68k_irq_startup(struct irq_data *data);
130+
extern unsigned int m68k_irq_startup_irq(unsigned int irq);
131+
extern void m68k_irq_shutdown(struct irq_data *data);
132+
extern void m68k_setup_auto_interrupt(void (*handler)(unsigned int,
133+
struct pt_regs *));
134+
extern void m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
135+
void (*handler)(unsigned int,
136+
struct pt_regs *));
137+
extern void m68k_setup_irq_controller(struct irq_chip *,
138+
void (*handle)(unsigned int irq,
139+
struct irq_desc *desc),
140+
unsigned int irq, unsigned int cnt);
141+
142+
#endif /* CONFIG_GENERIC_HARDIRQS */
143+
144+
extern unsigned int irq_canonicalize(unsigned int irq);
145+
124146
#else
125147
#define irq_canonicalize(irq) (irq)
126148
#endif /* CONFIG_MMU */
127149

128150
asmlinkage void do_IRQ(int irq, struct pt_regs *regs);
151+
extern atomic_t irq_err_count;
129152

130153
#endif /* _M68K_IRQ_H_ */

‎arch/m68k/kernel/Makefile‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ extra-y += vmlinux.lds
99
obj-y := entry.o m68k_ksyms.o module.o process.o ptrace.o setup.o signal.o \
1010
sys_m68k.o syscalltable.o time.o traps.o
1111

12-
obj-$(CONFIG_MMU) += ints.o devres.o vectors.o
12+
obj-$(CONFIG_MMU) += ints.o vectors.o
1313
devres-$(CONFIG_MMU) = ../../../kernel/irq/devres.o
1414

1515
ifndef CONFIG_MMU_SUN3
1616
obj-y += dma.o
1717
endif
1818
ifndef CONFIG_MMU
19-
obj-y += init_task.o irq.o
19+
obj-y += init_task.o
20+
endif
21+
ifdef CONFIG_GENERIC_HARDIRQS
22+
obj-y += irq.o
23+
else
24+
obj-y += devres.o
2025
endif
2126

‎arch/m68k/kernel/ints.c‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ extern u32 auto_irqhandler_fixup[];
3131
extern u32 user_irqhandler_fixup[];
3232
extern u16 user_irqvec_fixup[];
3333

34+
#ifndef CONFIG_GENERIC_HARDIRQS
3435
/* table for system interrupt handlers */
3536
static struct irq_data *irq_list[NR_IRQS];
3637
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)
4142
irq_chip[irq] = chip;
4243
return 0;
4344
}
45+
#define irq_set_chip_and_handler(irq, chip, dummy) irq_set_chip(irq, chip)
46+
#endif /* !CONFIG_GENERIC_HARDIRQS */
4447

4548
static int m68k_first_user_vec;
4649

@@ -56,8 +59,10 @@ static struct irq_chip user_irq_chip = {
5659
.irq_shutdown = m68k_irq_shutdown,
5760
};
5861

62+
#ifndef CONFIG_GENERIC_HARDIRQS
5963
#define NUM_IRQ_NODES 100
6064
static struct irq_data nodes[NUM_IRQ_NODES];
65+
#endif /* !CONFIG_GENERIC_HARDIRQS */
6166

6267
/*
6368
* void init_IRQ(void)
@@ -81,7 +86,7 @@ void __init init_IRQ(void)
8186
}
8287

8388
for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
84-
irq_set_chip(i, &auto_irq_chip);
89+
irq_set_chip_and_handler(i, &auto_irq_chip, handle_simple_irq);
8590

8691
mach_init_IRQ();
8792
}
@@ -128,6 +133,35 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
128133
flush_icache();
129134
}
130135

136+
#ifdef CONFIG_GENERIC_HARDIRQS
137+
138+
/**
139+
* m68k_setup_irq_controller
140+
* @chip: irq chip which controls specified irq
141+
* @handle: flow handler which handles specified irq
142+
* @irq: first irq to be managed by the controller
143+
* @cnt: number of irqs to be managed by the controller
144+
*
145+
* Change the controller for the specified range of irq, which will be used to
146+
* manage these irq. auto/user irq already have a default controller, which can
147+
* be changed as well, but the controller probably should use m68k_irq_startup/
148+
* m68k_irq_shutdown.
149+
*/
150+
void m68k_setup_irq_controller(struct irq_chip *chip,
151+
irq_flow_handler_t handle, unsigned int irq,
152+
unsigned int cnt)
153+
{
154+
int i;
155+
156+
for (i = 0; i < cnt; i++) {
157+
irq_set_chip(irq + i, chip);
158+
if (handle)
159+
irq_set_handler(irq + i, handle);
160+
}
161+
}
162+
163+
#else /* !CONFIG_GENERIC_HARDIRQS */
164+
131165
/**
132166
* m68k_setup_irq_chip
133167
* @contr: irq controller which controls specified irq
@@ -316,6 +350,8 @@ void disable_irq_nosync(unsigned int irq) __attribute__((alias("disable_irq")));
316350

317351
EXPORT_SYMBOL(disable_irq_nosync);
318352

353+
#endif /* !CONFIG_GENERIC_HARDIRQS */
354+
319355
unsigned int m68k_irq_startup_irq(unsigned int irq)
320356
{
321357
if (irq <= IRQ_AUTO_7)
@@ -341,6 +377,8 @@ void m68k_irq_shutdown(struct irq_data *data)
341377
}
342378

343379

380+
#ifndef CONFIG_GENERIC_HARDIRQS
381+
344382
/*
345383
* Do we need these probe functions on the m68k?
346384
*
@@ -367,6 +405,7 @@ int probe_irq_off (unsigned long irqs)
367405
}
368406

369407
EXPORT_SYMBOL(probe_irq_off);
408+
#endif /* CONFIG_GENERIC_HARDIRQS */
370409

371410
unsigned int irq_canonicalize(unsigned int irq)
372411
{
@@ -379,6 +418,7 @@ unsigned int irq_canonicalize(unsigned int irq)
379418

380419
EXPORT_SYMBOL(irq_canonicalize);
381420

421+
#ifndef CONFIG_GENERIC_HARDIRQS
382422
void generic_handle_irq(unsigned int irq)
383423
{
384424
struct irq_data *node;
@@ -428,3 +468,13 @@ void init_irq_proc(void)
428468
/* Insert /proc/irq driver here */
429469
}
430470
#endif
471+
472+
#else /* CONFIG_GENERIC_HARDIRQS */
473+
474+
asmlinkage void handle_badint(struct pt_regs *regs)
475+
{
476+
atomic_inc(&irq_err_count);
477+
pr_warn("unexpected interrupt from %u\n", regs->vector);
478+
}
479+
480+
#endif /* CONFIG_GENERIC_HARDIRQS */

0 commit comments

Comments
 (0)