ARM: Allow machine to specify it's own IRQ handlers at run-time
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Russell,
I wonder if it's still acceptable for a patch like below to have a dynamic IRQ handler at run-time. There is some changes to the irq_handler, esp. some SMP changes.
Magnus had some similar patches to have a run-time irq_handler, which is a bit more complicated, but I'm also very happy with.
commit d57e464929c9b2b50cda07e8683679583adf0fee
Author: Eric Miao <[email protected]> Date: Mon Nov 22 16:13:51 2010 +0800
ARM: Allow machine to specify it's own IRQ handlers at run-time
Normally different ARM platform has different way to decode the IRQ hardware status and demultiplex to the corresponding IRQ handler. This is highly optimized by macro irq_handler in entry-armv.S, and each machine class defines their own macro to decode the IRQ number. However, this prevents multiple machine classes to be built into a single kernel.
By allowing each machine to specify thier own handler, and making function pointer 'handle_arch_irq' to point to it at run time, this can be solved. And introduce CONFIG_MULTI_IRQ_HANDLER to allow both solutions to work.
Comparing with the highly optimized macro of irq_handler, the new function must be written with care not to lose too much performance. And the IPI stuff on SMP is expected to move to the provided arch IRQ handler as well.
arch/arm/Kconfig +5 -0
@@ -1017,6 +1017,11 @@ config CPU_HAS_PMU default y bool +config MULTI_IRQ_HANDLER + bool + help + Allow each machine to specify it's own IRQ handler at run time. + if !MMU source "arch/arm/Kconfig-nommu" endif
arch/arm/include/asm/mach/arch.h +3 -0
@@ -40,6 +40,9 @@ struct machine_desc {void (*init_irq)(void );struct sys_timer *timer;/* system tick timer */ void (*init_machine)(void ); +#ifdef CONFIG_MULTI_IRQ_HANDLER +void (*handle_irq)(struct pt_regs *); +#endif };/*
arch/arm/include/asm/mach/irq.h +4 -0
@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void);extern void init_FIQ (void );extern int show_fiq_list (struct seq_file *,void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +/* * This is for easy migration, but should be changed in the source */
arch/arm/kernel/entry-armv.S +15 -0
@@ -29,6 +29,7 @@ /* * Interrupt handling. Preserves r7, r8, r9 */ +#ifndef CONFIG_MULTI_IRQ_HANDLER .macro irq_handler get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr
@@ -62,6 +63,14 @@ #endif .endm +#else + .macro irq_handler + ldr r4, =handle_arch_irq + mov r0, sp + mov lr, pc + ldr pc, [r4] + .endm +#endif /* CONFIG_MULTI_IRQ_HANDLER */ #ifdef CONFIG_KPROBES .section .kprobes.text,"ax",%progbits
@@ -1245,3 +1254,9 @@ cr_alignment: .space 4 cr_no_alignment: .space 4 + +#ifdef CONFIG_MULTI_IRQ_HANDLER + .globl handle_arch_irq +handle_arch_irq: + .long 0 +#endif
arch/arm/kernel/setup.c +6 -0
@@ -876,6 +876,12 @@ void __init setup_arch(char **cmdline_p) system_timer = mdesc->timer; init_machine = mdesc->init_machine; +#ifdef CONFIG_MULTI_IRQ_HANDLER + handle_arch_irq = class ? class->handle_irq :NULL ; +if (!handle_arch_irq) +panic ("No machine class specific IRQ handler defined\n" ); +#endif +#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE ) conswitchp = &vga_con;
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 6 lines · Eric Miao
I wonder if it's still acceptable for a patch like below to have a dynamic IRQ handler at run-time. There is some changes to the
irq_handler, esp. some SMP changes.Magnus had some similar patches to have a run-time
irq_handler, which is a bit more complicated, but I'm also very happy with.
I'd prefer a simple but efficient approach. I am worried about unnecessarily increasing the IRQ latency - and IRQ latency is something that we should be concerned about. It has the ability to make platforms useless.
Eg, we know that SMC91x net interfaces are sensitive to IRQ latency, and the same is true of serial ports with small FIFOs.
Any attempt to support multiple IRQ handlers is going to increase IRQ handling latency - I don't think that's something which can be avoided, and I'm wondering what effect this and the recent genirq changes is going to have. Has anyone been keeping an eye on IRQ handling latency?
Lastly, this patch is dependent on your machine class patches, which makes it unsuitable as-is for mainline.
Quoted 125 lines
commit
d57e464929c9b2b50cda07e8683679583adf0feeAuthor: Eric Miao <[email protected]> Date: Mon Nov 22 16:13:51 2010 +0800ARM: Allow machine to specify it's own IRQ handlers at run-time
Normally different ARM platform has different way to decode the IRQ hardware status and demultiplex to the corresponding IRQ handler. This is highly optimized by macro
irq_handlerinentry-armv.S, and each machine class defines their own macro to decode the IRQ number. However, this prevents multiple machine classes to be built into a single kernel.By allowing each machine to specify thier own handler, and making function pointer '
handle_arch_irq' to point to it at run time, this can be solved. And introduceCONFIG_MULTI_IRQ_HANDLERto allow both solutions to work.Comparing with the highly optimized macro of
irq_handler, the new function must be written with care not to lose too much performance. And the IPI stuff on SMP is expected to move to the provided arch IRQ handler as well.Signed-off-by Eric Miao <[email protected]>Acked-by Nicolas Pitre <[email protected]>arch/arm/Kconfig +5
-0@@ -1017,6 +1017,11 @@ config CPU_HAS_PMU default y bool +config MULTI_IRQ_HANDLER + bool + help + Allow each machine to specify it's own IRQ handler at run time. + if !MMU source "arch/arm/Kconfig-nommu" endifarch/arm/include/asm/mach/arch.h +3
-0@@ -40,6 +40,9 @@ struct machine_desc {void (*init_irq)(void );struct sys_timer *timer;/* system tick timer */ void (*init_machine)(void ); +#ifdef CONFIG_MULTI_IRQ_HANDLER +void (*handle_irq)(struct pt_regs *); +#endif };/* arch/arm/include/asm/mach/irq.h +4
-0@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void);extern void init_FIQ (void );extern int show_fiq_list (struct seq_file *,void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +/* * This is for easy migration, but should be changed in the source */ arch/arm/kernel/entry-armv.S +15
-0@@ -29,6 +29,7 @@ /* * Interrupt handling. Preserves r7, r8, r9 */ +#ifndef CONFIG_MULTI_IRQ_HANDLER .macro irq_handler get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr@@ -62,6 +63,14 @@ #endif .endm +#else + .macro irq_handler + ldr r4, =handle_arch_irq + mov r0, sp + mov lr, pc + ldr pc, [r4] + .endm +#endif /* CONFIG_MULTI_IRQ_HANDLER */ #ifdef CONFIG_KPROBES .section .kprobes.text,"ax",%progbits@@ -1245,3 +1254,9 @@ cr_alignment: .space 4 cr_no_alignment: .space 4 + +#ifdef CONFIG_MULTI_IRQ_HANDLER + .globl handle_arch_irq +handle_arch_irq: + .long 0 +#endifarch/arm/kernel/setup.c +6
-0@@ -876,6 +876,12 @@ void __init setup_arch(char **cmdline_p) system_timer = mdesc->timer; init_machine = mdesc->init_machine; +#ifdef CONFIG_MULTI_IRQ_HANDLER + handle_arch_irq = class ? class->handle_irq :NULL ; +if (!handle_arch_irq) +panic ("No machine class specific IRQ handler defined\n" ); +#endif +#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE ) conswitchp = &vga_con;
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 16 lines · Russell King - ARM Linux
Quoted 6 lines · Eric Miao
I wonder if it's still acceptable for a patch like below to have a dynamic IRQ handler at run-time. There is some changes to the
irq_handler, esp. some SMP changes.Magnus had some similar patches to have a run-time
irq_handler, which is a bit more complicated, but I'm also very happy with.I'd prefer a simple but efficient approach. ?I am worried about unnecessarily increasing the IRQ latency - and IRQ latency is something that we should be concerned about. ?It has the ability to make platforms useless.
Eg, we know that SMC91x net interfaces are sensitive to IRQ latency, and the same is true of serial ports with small FIFOs.
Quoted 8 lines
Any attempt to support multiple IRQ handlers is going to increase IRQ handling latency - I don't think that's something which can be avoided, and I'm wondering what effect this and the recent genirq changes is going to have. ?Has anyone been keeping an eye on IRQ handling latency?
Lastly, this patch is dependent on your machine class patches, which makes it unsuitable as-is for mainline.
This one isn't. I've rebased this on top of v2.6.37-rc1.
Quoted 126 lines
Quoted 125 lines
commit
d57e464929c9b2b50cda07e8683679583adf0fee
Author: Eric Miao <[email protected]>
Date: ? Mon Nov 22 16:13:51 2010 +0800? ? ARM: Allow machine to specify it's own IRQ handlers at run-time
? ? Normally different ARM platform has different way to decode the IRQ ? ? hardware status and demultiplex to the corresponding IRQ handler. ? ? This is highly optimized by macro
irq_handlerinentry-armv.S, and ? ? each machine class defines their own macro to decode the IRQ number. ? ? However, this prevents multiple machine classes to be built into a ? ? single kernel.? ? By allowing each machine to specify thier own handler, and making ? ? function pointer '
handle_arch_irq' to point to it at run time, this ? ? can be solved. And introduceCONFIG_MULTI_IRQ_HANDLERto allow both ? ? solutions to work.? ? Comparing with the highly optimized macro of
irq_handler, the new ? ? function must be written with care not to lose too much performance. ? ? And the IPI stuff on SMP is expected to move to the provided arch ? ? IRQ handler as well.? ? Signed-off-by: Eric Miao <[email protected]> ? ? Acked-by: Nicolas Pitre <[email protected]>
arch/arm/Kconfig +0
-0@@ -1017,6 +1017,11 @@ config CPU_HAS_PMU? ? ? default y
? ? ? boolarch/arm/Kconfig +5
-0+config MULTI_IRQ_HANDLER + ? ? bool + ? ? help + ? ? ? Allow each machine to specify it's own IRQ handler at run time. +?if !MMU
?source "arch/arm/Kconfig-nommu"
?endifarch/arm/include/asm/mach/arch.h +0
-0@@ -40,6 +40,9 @@ struct machine_desc { ? ? ? void ? ? ? ? ? ? ? ? ? ?(*init_irq)(void);? ? ? struct
sys_timer? ? ? ?*timer; ? ? ? ? /* system tick timer ? ?*/ ? ? ? void ? ? ? ? ? ? ? ? ? ?(*init_machine)(void);arch/arm/include/asm/mach/arch.h +3
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? void ? ? ? ? ? ? ? ? ? ?(*handle_irq)(struct pt_regs *); +#endif ?};
?/*
arch/arm/include/asm/mach/irq.h +4
-0@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void); ?extern void init_FIQ(void); ?extern int show_fiq_list(struct seq_file *, void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +?/*
? * This is for easy migration, but should be changed in the source ? */arch/arm/kernel/entry-armv.S +0
-0@@ -29,6 +29,7 @@?/*
? * Interrupt handling. ?Preserves r7, r8, r9
? */
+#ifndefCONFIG_MULTI_IRQ_HANDLER
? ? ? .macro ?irq_handler
? ? ?get_irqnr_preambler5, lr
?1: ?get_irqnr_and_baser0, r6, r5, lrarch/arm/kernel/entry-armv.S +0
-0@@ -62,6 +63,14 @@?#endif
? ? ? .endm
arch/arm/kernel/entry-armv.S +8
-0+#else + ? ? .macro ?irq_handler + ? ? ldr ? ? r4, =handle_arch_irq + ? ? mov ? ? r0, sp + ? ? mov ? ? lr, pc + ? ? ldr ? ? pc, [r4] + ? ? .endm +#endif ? ? ? /* CONFIG_MULTI_IRQ_HANDLER */?#ifdef
CONFIG_KPROBES
? ? ? .section ? ? ? ?.kprobes.text,"ax",%progbitsarch/arm/kernel/entry-armv.S +0
-0@@ -1245,3 +1254,9 @@ cr_alignment:? ? ? .space ?4
?cr_no_alignment:
? ? ? .space ?4arch/arm/kernel/entry-armv.S +6
-0+ +#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? .globl ?handle_arch_irq +handle_arch_irq: + ? ? .long ? 0 +#endifarch/arm/kernel/setup.c +6
-0@@ -876,6 +876,12 @@ void __init setup_arch(char **cmdline_p) ? ? ? system_timer = mdesc->timer; ? ? ? init_machine = mdesc->init_machine; +#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? handle_arch_irq = class ? class->handle_irq : NULL; + ? ? if (!handle_arch_irq) + ? ? ? ? ? ? panic("No machine class specific IRQ handler defined\n"); +#endif +?#ifdef
CONFIG_VT
?#ifdefined(CONFIG_VGA_CONSOLE)
? ? ? conswitchp =&vga_con;
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 23 lines · Eric Miao
Quoted 21 lines · Russell King - ARM Linux
Quoted 6 lines · Eric Miao
I wonder if it's still acceptable for a patch like below to have a dynamic IRQ handler at run-time. There is some changes to the
irq_handler, esp. some SMP changes.Magnus had some similar patches to have a run-time
irq_handler, which is a bit more complicated, but I'm also very happy with.I'd prefer a simple but efficient approach. ?I am worried about unnecessarily increasing the IRQ latency - and IRQ latency is something that we should be concerned about. ?It has the ability to make platforms useless.
Eg, we know that SMC91x net interfaces are sensitive to IRQ latency, and the same is true of serial ports with small FIFOs.
Any attempt to support multiple IRQ handlers is going to increase IRQ handling latency - I don't think that's something which can be avoided, and I'm wondering what effect this and the recent genirq changes is going to have. ?Has anyone been keeping an eye on IRQ handling latency?
Quoted 8 lines
Quoted 3 lines
Lastly, this patch is dependent on your machine class patches, which makes it unsuitable as-is for mainline.
This one isn't. I've rebased this on top of v2.6.37-rc1.
Quoted 2 lines
Quoted 2 lines
+#ifdef
CONFIG_MULTI_IRQ_HANDLER
+ ? ?handle_arch_irq= class ?class->handle_irq: NULL;
^^^^^^^^^^^^^^^^^^^^^^^^^
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 28 lines · Russell King - ARM Linux
Quoted 27 lines · Eric Miao
Quoted 24 lines · Russell King - ARM Linux
Quoted 6 lines · Eric Miao
I wonder if it's still acceptable for a patch like below to have a dynamic IRQ handler at run-time. There is some changes to the
irq_handler, esp. some SMP changes.Magnus had some similar patches to have a run-time
irq_handler, which is a bit more complicated, but I'm also very happy with.I'd prefer a simple but efficient approach. ?I am worried about unnecessarily increasing the IRQ latency - and IRQ latency is something that we should be concerned about. ?It has the ability to make platforms useless.
Eg, we know that SMC91x net interfaces are sensitive to IRQ latency, and the same is true of serial ports with small FIFOs.
Any attempt to support multiple IRQ handlers is going to increase IRQ handling latency - I don't think that's something which can be avoided, and I'm wondering what effect this and the recent genirq changes is going to have. ?Has anyone been keeping an eye on IRQ handling latency?
Lastly, this patch is dependent on your machine class patches, which makes it unsuitable as-is for mainline.
Quoted 6 lines
Quoted 4 lines
This one isn't. I've rebased this on top of v2.6.37-rc1.
Quoted 2 lines
Quoted 2 lines
+#ifdef
CONFIG_MULTI_IRQ_HANDLER
+ ? ?handle_arch_irq= class ?class->handle_irq: NULL;? ? ? ? ? ? ? ? ? ? ? ? ? ? ^^^^^^^^^^^^^^^^^^^^^^^^^
Grrrr... wrong copy indeed. Corrected version below, I also made it less intrusive by judging on handle_arch_irq being NULL or not so to fall back to the original way of handling.
arch/arm/Kconfig +5 -0
@@ -1017,6 +1017,11 @@ config CPU_HAS_PMU default y bool +config MULTI_IRQ_HANDLER + bool + help + Allow each machine to specify it's own IRQ handler at run time. + if !MMU source "arch/arm/Kconfig-nommu" endif
arch/arm/include/asm/mach/arch.h +3 -0
@@ -40,6 +40,9 @@ struct machine_desc {void (*init_irq)(void );struct sys_timer *timer;/* system tick timer */ void (*init_machine)(void ); +#ifdef CONFIG_MULTI_IRQ_HANDLER +void (*handle_irq)(struct pt_regs *); +#endif };/*
arch/arm/include/asm/mach/irq.h +4 -0
@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void);extern void init_FIQ (void );extern int show_fiq_list (struct seq_file *,void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +/* * This is for easy migration, but should be changed in the source */
arch/arm/kernel/entry-armv.S +13 -0
@@ -30,6 +30,13 @@ * Interrupt handling. Preserves r7, r8, r9 */ .macro irq_handler +#ifdef CONFIG_MULTI_IRQ_HANDLER + ldr r1, =handle_arch_irq + cmp r1, #0 + movne r0, sp + adrne lr, BSYM(9997f) + ldrne pc, [r1] +#endif get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr movne r1, sp
@@ -1245,3 +1252,9 @@ cr_alignment: .space 4 cr_no_alignment: .space 4 + +#ifdef CONFIG_MULTI_IRQ_HANDLER + .globl handle_arch_irq +handle_arch_irq: + .long 0 +#endif
arch/arm/kernel/setup.c +3 -0
@@ -875,6 +875,9 @@ void __init setup_arch(char **cmdline_p) init_arch_irq = mdesc->init_irq; system_timer = mdesc->timer; init_machine = mdesc->init_machine; +#ifdef CONFIG_MULTI_IRQ_HANDLER + handle_arch_irq = mdesc->handle_irq; +#endif #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE )
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 3 lines · Eric Miao
Grrrr... wrong copy indeed. Corrected version below, I also made it less intrusive by judging on
handle_arch_irqbeing NULL or not so to fall back to the original way of handling.
...
Quoted 5 lines
arch/arm/kernel/entry-armv.S +0
-0
arch/arm/kernel/entry-armv.S line 39
Quoted 10 lines
arch/arm/kernel/entry-armv.S +7
-0@@ -30,6 +30,13 @@ * Interrupt handling. Preserves r7, r8, r9 */ .macro irq_handler +#ifdef CONFIG_MULTI_IRQ_HANDLER + ldr r1, =handle_arch_irq + cmp r1, #0 + movne r0, sp + adrne lr, BSYM(9997f) + ldrne pc, [r1] +#endif
Except this won't - you're testing the address of handle_arch_irq for NULL, which it'll never be.
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 15 lines · Russell King - ARM Linux
Quoted 3 lines · Eric Miao
Grrrr... wrong copy indeed. Corrected version below, I also made it less intrusive by judging on
handle_arch_irqbeing NULL or not so to fall back to the original way of handling....
Quoted 10 lines
arch/arm/kernel/entry-armv.S +0
-0@@ -30,6 +30,13 @@? * Interrupt handling. ?Preserves r7, r8, r9
? */
? ? ? .macro ?irq_handler
+#ifdefCONFIG_MULTI_IRQ_HANDLER
+ ? ? ldr ? ? r1, =handle_arch_irq
Quoted 9 lines
Quoted 5 lines
+ ? ? cmp ? ? r1, #0
+ ? ? movne ? r0, sp
+ ? ? adrne ? lr, BSYM(9997f)
+ ? ? ldrne ? pc, [r1]
+#endifExcept this won't - you're testing the address of
handle_arch_irqfor NULL, which it'll never be.
Ah silly me, the patch below fixed this, and tested on Marvell Dove:
arch/arm/Kconfig +5 -0
@@ -1017,6 +1017,11 @@ config CPU_HAS_PMU default y bool +config MULTI_IRQ_HANDLER + bool + help + Allow each machine to specify it's own IRQ handler at run time. + if !MMU source "arch/arm/Kconfig-nommu" endif
arch/arm/include/asm/mach/arch.h +3 -0
@@ -40,6 +40,9 @@ struct machine_desc {void (*init_irq)(void );struct sys_timer *timer;/* system tick timer */ void (*init_machine)(void ); +#ifdef CONFIG_MULTI_IRQ_HANDLER +void (*handle_irq)(struct pt_regs *); +#endif };/*
arch/arm/include/asm/mach/irq.h +4 -0
@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void);extern void init_FIQ (void );extern int show_fiq_list (struct seq_file *,void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +/* * This is for easy migration, but should be changed in the source */
arch/arm/kernel/entry-armv.S +15 -2
@@ -30,6 +30,14 @@ * Interrupt handling. Preserves r7, r8, r9 */ .macro irq_handler +#ifdef CONFIG_MULTI_IRQ_HANDLER + ldr r1, =handle_arch_irq + ldr r0, [r1] + cmp r0, #0 + movne r0, sp + adrne lr, BSYM(9997f) + ldrne pc, [r1] +#endif get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr movne r1, sp
@@ -58,9 +66,8 @@ adrne lr, BSYM(1b) bne do_local_timer #endif -9997: #endif - +9997: .endm #ifdef CONFIG_KPROBES
@@ -1245,3 +1252,9 @@ cr_alignment: .space 4 cr_no_alignment: .space 4 + +#ifdef CONFIG_MULTI_IRQ_HANDLER + .globl handle_arch_irq +handle_arch_irq: + .long 0 +#endif
arch/arm/kernel/setup.c +3 -0
@@ -875,6 +875,9 @@ void __init setup_arch(char **cmdline_p) init_arch_irq = mdesc->init_irq; system_timer = mdesc->timer; init_machine = mdesc->init_machine; +#ifdef CONFIG_MULTI_IRQ_HANDLER + handle_arch_irq = mdesc->handle_irq; +#endif #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE )
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 1 line · Eric Miao
Ah silly me, the patch below fixed this, and tested on Marvell Dove:
...
Quoted 21 lines
arch/arm/include/asm/mach/irq.h +4
-0@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void);extern void init_FIQ (void );extern int show_fiq_list (struct seq_file *,void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +/* * This is for easy migration, but should be changed in the source */ arch/arm/kernel/entry-armv.S +0
-0@@ -30,6 +30,14 @@ * Interrupt handling. Preserves r7, r8, r9
arch/arm/kernel/entry-armv.S line 40
Quoted 10 lines
arch/arm/kernel/entry-armv.S +8
-0*/ .macro irq_handler +#ifdef CONFIG_MULTI_IRQ_HANDLER + ldr r1, =handle_arch_irq + ldr r0, [r1] + cmp r0, #0 + movne r0, sp + adrne lr, BSYM(9997f) + ldrne pc, [r1] +#endif
You might as well do this:
ldr r5, =handle_arch_irq mov r0, sp ldr r5, [r5] adr lr, BSYM(9997f) teq r5, #0 movne pc, r5
which also helps to fill the load delay slots with useful work.
Quoted 15 lines
arch/arm/kernel/entry-armv.S +1
-2get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr movne r1, sp@@ -58,9 +66,8 @@ adrne lr, BSYM(1b) bne do_local_timer #endif -9997: #endif - +9997: .endm #ifdef CONFIG_KPROBES
arch/arm/kernel/entry-armv.S cr_alignment: · line 1259
Quoted 8 lines
arch/arm/kernel/entry-armv.S +5
-0@@ -1245,3 +1252,9 @@ cr_alignment: .space 4 cr_no_alignment: .space 4 + +#ifdef CONFIG_MULTI_IRQ_HANDLER + .globl handle_arch_irq +handle_arch_irq: + .long 0
.space 4
as above please
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 72 lines · Russell King - ARM Linux
Quoted 1 line · Eric Miao
Ah silly me, the patch below fixed this, and tested on Marvell Dove:
...
Quoted 23 lines
arch/arm/include/asm/mach/irq.h +4
-0@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void); ?extern void init_FIQ(void); ?extern int show_fiq_list(struct seq_file *, void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +?/*
? * This is for easy migration, but should be changed in the source ? */arch/arm/kernel/entry-armv.S +0
-0@@ -30,6 +30,14 @@? * Interrupt handling. ?Preserves r7, r8, r9
? */
? ? ? .macro ?irq_handlerarch/arm/kernel/entry-armv.S
Quoted 8 lines
arch/arm/kernel/entry-armv.S +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? ldr ? ? r1, =handle_arch_irq + ? ? ldr ? ? r0, [r1] + ? ? cmp ? ? r0, #0 + ? ? movne ? r0, sp + ? ? adrne ? lr, BSYM(9997f) + ? ? ldrne ? pc, [r1] +#endifYou might as well do this:
? ? ? ?ldr ? ? r5, =handle_arch_irq
? ? ? ?mov ? ? r0, sp
? ? ? ?ldr ? ? r5, [r5]
? ? ? ?adr ? ? lr, BSYM(9997f)
? ? ? ?teq ? ? r5, #0
? ? ? ?movne ? pc, r5which also helps to fill the load delay slots with useful work.
Quoted 18 lines
? ? ?
get_irqnr_preambler5, lr
?1: ?get_irqnr_and_baser0, r6, r5, lr
? ? ? movne ? r1, sparch/arm/kernel/entry-armv.S +0
-0@@ -58,9 +66,8 @@ ? ? ? adrne ? lr, BSYM(1b)? ? ? bne ? ?
do_local_timer
?#endif
-9997:
?#endif
-
+9997:
? ? ? .endm?#ifdef
CONFIG_KPROBESarch/arm/kernel/entry-armv.S +0
-0@@ -1245,3 +1252,9 @@ cr_alignment:? ? ? .space ?4
?cr_no_alignment:
? ? ? .space ?4arch/arm/kernel/entry-armv.S
Quoted 5 lines
arch/arm/kernel/entry-armv.S +5
-0+ +#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? .globl ?handle_arch_irq +handle_arch_irq: + ? ? .long ? 0? ? ? ?.space 4
Quoted 2 lines
as above please
Updated the patch following your suggestions, verified on Marvell Dove platform and it worked all right. Do you want me to submit this to the patch tracking system?
arch/arm/Kconfig +5 -0
@@ -1017,6 +1017,11 @@ config CPU_HAS_PMU default y bool +config MULTI_IRQ_HANDLER + bool + help + Allow each machine to specify it's own IRQ handler at run time. + if !MMU source "arch/arm/Kconfig-nommu" endif
arch/arm/include/asm/mach/arch.h +3 -0
@@ -40,6 +40,9 @@ struct machine_desc {void (*init_irq)(void );struct sys_timer *timer;/* system tick timer */ void (*init_machine)(void ); +#ifdef CONFIG_MULTI_IRQ_HANDLER +void (*handle_irq)(struct pt_regs *); +#endif };/*
arch/arm/include/asm/mach/irq.h +4 -0
@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void);extern void init_FIQ (void );extern int show_fiq_list (struct seq_file *,void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +/* * This is for easy migration, but should be changed in the source */
arch/arm/kernel/entry-armv.S +15 -2
@@ -30,6 +30,14 @@ * Interrupt handling. Preserves r7, r8, r9 */ .macro irq_handler +#ifdef CONFIG_MULTI_IRQ_HANDLER + ldr r1, =handle_arch_irq + ldr r0, [r1] + cmp r0, #0 + movne r0, sp + adrne lr, BSYM(9997f) + ldrne pc, [r1] +#endif get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr movne r1, sp
@@ -58,9 +66,8 @@ adrne lr, BSYM(1b) bne do_local_timer #endif -9997: #endif - +9997: .endm #ifdef CONFIG_KPROBES
@@ -1245,3 +1252,9 @@ cr_alignment: .space 4 cr_no_alignment: .space 4 + +#ifdef CONFIG_MULTI_IRQ_HANDLER + .globl handle_arch_irq +handle_arch_irq: + .long 0 +#endif
arch/arm/kernel/setup.c +3 -0
@@ -875,6 +875,9 @@ void __init setup_arch(char **cmdline_p) init_arch_irq = mdesc->init_irq; system_timer = mdesc->timer; init_machine = mdesc->init_machine; +#ifdef CONFIG_MULTI_IRQ_HANDLER + handle_arch_irq = mdesc->handle_irq; +#endif #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE )
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 15 lines · Eric Miao
Quoted 12 lines · Russell King - ARM Linux
Review
Quoted 8 lines · Eric Miao
(quoted diff) +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? ldr ? ? r1, =handle_arch_irq + ? ? ldr ? ? r0, [r1] + ? ? cmp ? ? r0, #0 + ? ? movne ? r0, sp + ? ? adrne ? lr, BSYM(9997f) + ? ? ldrne ? pc, [r1] +#endifYou might as well do this:
...
arch/arm/kernel/entry-armv.S line 40
Quoted 8 lines
arch/arm/kernel/entry-armv.S +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ldr r1, =handle_arch_irq + ldr r0, [r1] + cmp r0, #0 + movne r0, sp + adrne lr, BSYM(9997f) + ldrne pc, [r1] +#endif
This looks suspiciously like the old version to me.
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 16 lines · Russell King - ARM Linux
Quoted 14 lines · Eric Miao
Quoted 12 lines · Russell King - ARM Linux
Review
Quoted 8 lines · Eric Miao
(quoted diff) +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? ldr ? ? r1, =handle_arch_irq + ? ? ldr ? ? r0, [r1] + ? ? cmp ? ? r0, #0 + ? ? movne ? r0, sp + ? ? adrne ? lr, BSYM(9997f) + ? ? ldrne ? pc, [r1] +#endifYou might as well do this:
...
Quoted 11 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? ldr ? ? r1, =handle_arch_irq + ? ? ldr ? ? r0, [r1] + ? ? cmp ? ? r0, #0 + ? ? movne ? r0, sp + ? ? adrne ? lr, BSYM(9997f) + ? ? ldrne ? pc, [r1] +#endifThis looks suspiciously like the old version to me.
Yeah, my brain malfunctioned. :-)
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Quoted 30 lines · Eric Miao
Quoted 16 lines · Russell King - ARM Linux
Quoted 14 lines · Eric Miao
Quoted 12 lines · Russell King - ARM Linux
Review
Quoted 8 lines · Eric Miao
(quoted diff) +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? ldr ? ? r1, =handle_arch_irq + ? ? ldr ? ? r0, [r1] + ? ? cmp ? ? r0, #0 + ? ? movne ? r0, sp + ? ? adrne ? lr, BSYM(9997f) + ? ? ldrne ? pc, [r1] +#endifYou might as well do this:
...Quoted 11 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? ldr ? ? r1, =handle_arch_irq + ? ? ldr ? ? r0, [r1] + ? ? cmp ? ? r0, #0 + ? ? movne ? r0, sp + ? ? adrne ? lr, BSYM(9997f) + ? ? ldrne ? pc, [r1] +#endifThis looks suspiciously like the old version to me.
Quoted 2 lines
Yeah, my brain malfunctioned. :-)
Hi Russell,
I've submitted the patch to your patch tracking system with the line below:
The assembly code to invoke handle_arch_irq is optimized by Russell King.
Shame that it now looks I did almost nothing to this patch :-)
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
Hi Eric,
Quoted 9 lines · Eric Miao
Hi Russell,
I've submitted the patch to your patch tracking system with the line below:
The assembly code to invoke
handle_arch_irqis optimized by Russell King.Shame that it now looks I did almost nothing to this patch :-)
Thanks for your work on this. I've tried out your patch on real hardware today and it works well. Sorry for not giving you more feedback earlier. No need to rip the patch out of the tracker or anything, but feel free to add my acked-by if you happen to resubmit in the future.
Cheers,
/ magnus
PATCH 1/1 ARM: Allow machine to specify it's own IRQ handlers at run-time
In reply to Eric MiaoQuoted 74 lines · Eric Miao
Quoted 72 lines · Russell King - ARM Linux
Quoted 1 line · Eric Miao
Ah silly me, the patch below fixed this, and tested on Marvell Dove:
...
Quoted 23 lines
arch/arm/include/asm/mach/irq.h +4
-0@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void); ?extern void init_FIQ(void); ?extern int show_fiq_list(struct seq_file *, void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +?/*
? * This is for easy migration, but should be changed in the source ? */arch/arm/kernel/entry-armv.S +0
-0@@ -30,6 +30,14 @@? * Interrupt handling. ?Preserves r7, r8, r9
? */
? ? ? .macro ?irq_handlerarch/arm/kernel/entry-armv.S
Quoted 8 lines
arch/arm/kernel/entry-armv.S +8
-0+#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? ldr ? ? r1, =handle_arch_irq + ? ? ldr ? ? r0, [r1] + ? ? cmp ? ? r0, #0 + ? ? movne ? r0, sp + ? ? adrne ? lr, BSYM(9997f) + ? ? ldrne ? pc, [r1] +#endifYou might as well do this:
? ? ? ?ldr ? ? r5, =handle_arch_irq
? ? ? ?mov ? ? r0, sp
? ? ? ?ldr ? ? r5, [r5]
? ? ? ?adr ? ? lr, BSYM(9997f)
? ? ? ?teq ? ? r5, #0
? ? ? ?movne ? pc, r5which also helps to fill the load delay slots with useful work.
Quoted 18 lines
? ? ?
get_irqnr_preambler5, lr
?1: ?get_irqnr_and_baser0, r6, r5, lr
? ? ? movne ? r1, sparch/arm/kernel/entry-armv.S +0
-0@@ -58,9 +66,8 @@ ? ? ? adrne ? lr, BSYM(1b)? ? ? bne ? ?
do_local_timer
?#endif
-9997:
?#endif
-
+9997:
? ? ? .endm?#ifdef
CONFIG_KPROBESarch/arm/kernel/entry-armv.S +0
-0@@ -1245,3 +1252,9 @@ cr_alignment:? ? ? .space ?4
?cr_no_alignment:
? ? ? .space ?4arch/arm/kernel/entry-armv.S
Quoted 5 lines
arch/arm/kernel/entry-armv.S +5
-0+ +#ifdef CONFIG_MULTI_IRQ_HANDLER + ? ? .globl ?handle_arch_irq +handle_arch_irq: + ? ? .long ? 0? ? ? ?.space 4
Quoted 7 lines
Quoted 2 lines
as above please
Updated the patch following your suggestions, verified on Marvell Dove platform and it worked all right. Do you want me to submit this to the patch tracking system?
(ignore my last mail with the wrong patch, my brain short circuited today, here's the updated one):
arch/arm/Kconfig +5 -0
@@ -1017,6 +1017,11 @@ config CPU_HAS_PMU default y bool +config MULTI_IRQ_HANDLER + bool + help + Allow each machine to specify it's own IRQ handler at run time. + if !MMU source "arch/arm/Kconfig-nommu" endif
arch/arm/include/asm/mach/arch.h +3 -0
@@ -40,6 +40,9 @@ struct machine_desc {void (*init_irq)(void );struct sys_timer *timer;/* system tick timer */ void (*init_machine)(void ); +#ifdef CONFIG_MULTI_IRQ_HANDLER +void (*handle_irq)(struct pt_regs *); +#endif };/*
arch/arm/include/asm/mach/irq.h +4 -0
@@ -22,6 +22,10 @@ extern void (*init_arch_irq)(void);extern void init_FIQ (void );extern int show_fiq_list (struct seq_file *,void *); +#ifdef CONFIG_MULTI_IRQ_HANDLER +extern void (*handle_arch_irq)(struct pt_regs *); +#endif +/* * This is for easy migration, but should be changed in the source */
arch/arm/kernel/entry-armv.S +15 -2
@@ -30,6 +30,14 @@ * Interrupt handling. Preserves r7, r8, r9 */ .macro irq_handler +#ifdef CONFIG_MULTI_IRQ_HANDLER + ldr r5, =handle_arch_irq + mov r0, sp + ldr r5, [r5] + adr lr, BSYM(9997f) + teq r5, #0 + movne pc, r5 +#endif get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr movne r1, sp
@@ -58,9 +66,8 @@ adrne lr, BSYM(1b) bne do_local_timer #endif -9997: #endif - +9997: .endm #ifdef CONFIG_KPROBES
@@ -1245,3 +1252,9 @@ cr_alignment: .space 4 cr_no_alignment: .space 4 + +#ifdef CONFIG_MULTI_IRQ_HANDLER + .globl handle_arch_irq +handle_arch_irq: + .space 4 +#endif
arch/arm/kernel/setup.c +3 -0
@@ -875,6 +875,9 @@ void __init setup_arch(char **cmdline_p) init_arch_irq = mdesc->init_irq; system_timer = mdesc->timer; init_machine = mdesc->init_machine; +#ifdef CONFIG_MULTI_IRQ_HANDLER + handle_arch_irq = mdesc->handle_irq; +#endif #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE )