sparc32: genirq support
PATCH 4/4 sparc32: genirq support
generic
Introduce use of GENERIC_HARDIRQS
Allocate 64 IRQs - which is enough even for SS2000 Use a table of irq_bucket to maintain uses IRQs
irq_bucket is also used to chain several irq's that must be called when the same intrrupt is asserted
Use irq_link to link a interrupt source to the irq All plafforms must now supply their own build_device_irq method Use show_interrupts from sparc64
handler_irq rewriten to use generic irq support
floppy
Read FLOPPY_IRQ from plat_From device
Use generic request_irq to register the floppy interrupt Rewrote sparc_floppy_irq to use the generic irq support
sun4c:
Introduce irq_chip
Store mask in chip_data for use in mask/unmask functions Add build_device_irq for sun4c
Use sun4c_build_device_irq in sun4c_init_timers
sun4m:
Introduce irq_chip
Introduce dedicated mask/unmask methods
Introduce sun4m_handler_data that allow easy access to necessary
data in the mask/unmask functions
Add a helper method to enable profile_timer (used from smp) Added sun4m_build_device_irq
Use sun4m_build_device_irq in sun4m_init_timers
MISSING:
There is no replacement for smp_rotate that always scheduled next CPU as interrupt target upon an interrupt
sun4d:
Introduce irq_chip
Introduce dedicated mask/unmask methods Introduce sun4d_handler_data that allow easy access to necessary data in mask/unmask fuctions
Rename sbus_tid to board_to_cpu
Rewrote sun4d_handler_irq to use generic irq support
MISSING:
The original implmentation of enable/disable had:
if (irq < NR_IRQS)
return;
The new implmentation does not distingush between SBUS and cpu interrupts.
I am no sure what is right here. I assume we need to do something for the cpu interrupts.
I have (not yet at least) sun4d hardware available, and my understanding of this platfrom is limited. So I would be a bit suprised if this works. Some extra eyes on the codes would be great!
leon:
Not converted yet - I hope the Gaisler team will look into this!
--- arch/sparc/Kconfig | 5 +- arch/sparc/include/asm/floppy_32.h | 41 ++- arch/sparc/include/asm/irq_32.h | 8 +- arch/sparc/include/asm/system_32.h | 5 - arch/sparc/kernel/Makefile | 4 - arch/sparc/kernel/irq.h | 47 ++-- arch/sparc/kernel/irq_32.c | 506 +++++++----------------------- arch/sparc/kernel/kernel.h | 7 +- arch/sparc/kernel/pcic.c | 42 --- arch/sparc/kernel/sun4c_irq.c | 144 +++++---- arch/sparc/kernel/sun4d_irq.c | 597 ++++++++++++++---------------------- arch/sparc/kernel/sun4m_irq.c | 174 ++++++----- arch/sparc/kernel/sun4m_smp.c | 16 +- 13 files changed, 594 insertions(+), 1002 deletions(-)
arch/sparc/Kconfig +3 -2
@@ -25,6 +25,9 @@ config SPARC select HAVE_DMA_ATTRS select HAVE_DMA_API_DEBUG select HAVE_ARCH_JUMP_LABEL + select HAVE_GENERIC_HARDIRQS + select GENERIC_HARDIRQS_NO_DEPRECATED + config SPARC32 def_bool !64BIT
@@ -50,8 +53,6 @@ config SPARC64 select RTC_DRV_STARFIRE select HAVE_PERF_EVENTS select PERF_USE_VMALLOC - select HAVE_GENERIC_HARDIRQS - select GENERIC_HARDIRQS_NO_DEPRECATED config ARCH_DEFCONFIG string
arch/sparc/include/asm/floppy_32.h +30 -11
71 lines not on this page · raw message
arch/sparc/include/asm/irq_32.h +7 -1
@@ -6,11 +6,17 @@#ifndef _SPARC_IRQ_H#define _SPARC_IRQ_H -#define NR_IRQS 16 +/* +* Allocated number of logical irq numbers. +* sun4d boxes (ss2000e) should be OK with ~32. +* Be on the safe side and make room for 64 +*/ +#define NR_IRQS 64#include <linux/interrupt.h> #define irq_canonicalize (irq) (irq)extern void __init init_IRQ (void ); +#endif
arch/sparc/include/asm/system_32.h +0 -5
@@ -15,11 +15,6 @@#include <linux/irqflags.h> -static inline unsigned int probe_irq_mask (unsigned long val) -{ -return 0 ; -} -/* * Sparc (general) CPU types */
arch/sparc/kernel/Makefile +0 -4
@@ -71,10 +71,6 @@ obj-$(CONFIG_SPARC64) += pcr.o obj-$(CONFIG_SPARC64) += nmi.o obj-$(CONFIG_SPARC64_SMP) += cpumap.o -# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation -obj-$(CONFIG_SPARC32) += devres.o -devres-y := ../../../kernel/irq/devres.o - obj-y += dma.o obj-$(CONFIG_SPARC32_PCI) += pcic.o
arch/sparc/kernel/irq.h +22 -25
71 lines not on this page · raw message
arch/sparc/kernel/irq_32.c +120 -386
602 lines not on this page · raw message
arch/sparc/kernel/kernel.h +4 -3
@@ -35,6 +35,7 @@ extern void sun4c_init_IRQ(void);extern unsigned int lvl14_resolution;extern void sun4m_init_IRQ (void ); +extern void sun4m_unmask_profile_irq (void );extern void sun4m_clear_profile_irq (int cpu);/* sun4d_irq.c */
@@ -54,9 +55,9 @@ extern unsigned int t_nmi[];extern unsigned int linux_trap_ipi15_sun4d[];extern unsigned int linux_trap_ipi15_sun4m[]; -extern unsigned long trapbase_cpu1[]; -extern unsigned long trapbase_cpu2[]; -extern unsigned long trapbase_cpu3[]; +extern struct tt_entry trapbase_cpu1; +extern struct tt_entry trapbase_cpu2; +extern struct tt_entry trapbase_cpu3;extern char cputypval[];
arch/sparc/kernel/pcic.c +0 -42
55 lines not on this page · raw message
arch/sparc/kernel/sun4c_irq.c +84 -60
192 lines not on this page · raw message
arch/sparc/kernel/sun4d_irq.c +231 -366
731 lines not on this page · raw message
arch/sparc/kernel/sun4m_irq.c +92 -82
254 lines not on this page · raw message
arch/sparc/kernel/sun4m_smp.c +1 -15
@@ -150,20 +150,6 @@ void __init smp4m_smp_done(void)/* Ok, they are spinning and ready to go. */ } -/* At each hardware IRQ, we get this called to forward IRQ reception -* to the next processor. The caller must disable the IRQ level being -* serviced globally so that there are no double interrupts received. -* -* XXX See sparc64 irq.c. -*/ -void smp4m_irq_rotate (int cpu) -{ -int next =cpu_data (cpu).next; - -if (next != cpu) -set_irq_udt (next); -} - static struct smp_funcall { smpfunc_t func; unsigned long arg1;
@@ -277,7 +263,7 @@ static void __cpuinit smp_setup_percpu_timer(void)load_profile_irq (cpu, lvl14_resolution);if (cpu = boot_cpu_id) -enable_pil_irq (14 ); +sun4m_unmask_profile_irq (); }static void __init smp4m_blackbox_id (unsigned *addr)
Signature · 1 line
1.6.0.6
Quoted 97 lines · Sam Ravnborg
arch/sparc/kernel/sun4d_irq.c +40
-52-static void __init sun4d_init_timers (irq_handler_t counter_fn) -{ -struct device_node *dp; -struct resource res; -const u32 *reg; -int err; - - dp =of_find_node_by_name (NULL ,"cpu-unit" ); -if (!dp) { -prom_printf ("sun4d_init_timers: Unable to find cpu-unit\n" ); -prom_halt (); - } - -/* Which cpu-unit we use is arbitrary, we can view the bootbus timer -* registers via any cpu's mapping. The first 'reg' property is the -* bootbus. -*/ - reg =of_get_property (dp,"reg" ,NULL ); -of_node_put (dp); -if (!reg) { -prom_printf ("sun4d_init_timers: No reg property\n" ); -prom_halt (); - } - - res.start = reg[1 ]; - res.end = reg[2 ] -1 ; - res.flags = reg[0 ] &0xff ; - sun4d_timers =of_ioremap (&res,BW_TIMER_LIMIT , -sizeof (struct sun4d_timer_regs ),"user timer" ); -if (!sun4d_timers) { -prom_printf ("sun4d_init_timers: Can't map timer regs\n" ); -prom_halt (); - } - -sbus_writel ((((1000000 /HZ ) +1 ) <<10 ), &sun4d_timers->l10_timer_limit); - - master_l10_counter = &sun4d_timers->l10_cur_count; - - err =request_irq (TIMER_IRQ , counter_fn, - (IRQF_DISABLED |SA_STATIC_ALLOC ), -"timer" ,NULL ); -if (err) { -prom_printf ("sun4d_init_timers: request_irq() failed with %d\n" , - err); -prom_halt (); - } -sun4d_load_profile_irqs (); -sun4d_fixup_trap_table (); -} - +static void __init sun4d_init_timers (irq_handler_t counter_fn) +{ +struct device_node *dp; +struct resource res; +unsigned int irq; +const u32 *reg; +int err; + + dp =of_find_node_by_name (NULL ,"cpu-unit" ); +if (!dp) { +prom_printf ("sun4d_init_timers: Unable to find cpu-unit\n" ); +prom_halt (); + } + +/* Which cpu-unit we use is arbitrary, we can view the bootbus timer +* registers via any cpu's mapping. The first 'reg' property is the +* bootbus. +*/ + reg =of_get_property (dp,"reg" ,NULL ); +of_node_put (dp); +if (!reg) { +prom_printf ("sun4d_init_timers: No reg property\n" ); +prom_halt (); + } + + res.start = reg[1 ]; + res.end = reg[2 ] -1 ; + res.flags = reg[0 ] &0xff ; + sun4d_timers =of_ioremap (&res,BW_TIMER_LIMIT , +sizeof (struct sun4d_timer_regs ),"user timer" ); +if (!sun4d_timers) { +prom_printf ("sun4d_init_timers: Can't map timer regs\n" ); +prom_halt (); + } + +sbus_writel ((((1000000 /HZ ) +1 ) <<10 ), &sun4d_timers->l10_timer_limit); + + master_l10_counter = &sun4d_timers->l10_cur_count; -err_out: -return interrupt; + irq =sun4d_build_device_irq (NULL ,SUN4D_TIMER_IRQ ); + err =request_irq (irq, counter_fn,IRQF_TIMER ,"timer" ,NULL );
arch/sparc/kernel/sun4d_irq.c
Quoted 10 lines
arch/sparc/kernel/sun4d_irq.c +8
-0+if (err) { +prom_printf ("sun4d_init_timers: request_irq() failed with %d\n" , + err); +prom_halt (); + } +sun4d_load_profile_irqs (); +sun4d_fixup_trap_table (); } +
In this case the diff output isn't really useful, it has to be re-diffed manually to see the actual difference. Granted, it's nothing important in this case, but you should try to keep the mostly identical functions in the same place in the same commit, and then move the new version into a new place in a later commit, so that functional changes don't get obscured by formatting changes.
(Sorry not to be of any actual help - the oldest sparc machine I have access to is an Ultra 5, and even that one is so slow that it makes the simple act of compiling the kernel to test it - really tedious *shrug* :)
Signature · 1 line
2. That which causes joy or happiness.
Hi Josip.
Quoted 6 lines
In this case the diff output isn't really useful, it has to be re-diffed manually to see the actual difference. Granted, it's nothing important in this case, but you should try to keep the mostly identical functions in the same place in the same commit, and then move the new version into a new place in a later commit, so that functional changes don't get obscured by formatting changes.
The sun4d_irq file almost saw an rewrite and as part of this I had to move the sun4d_init_timers function to avoid a forward declaration. I will try to do so in a preparational patch in v3 - the patch is in no way easy to review as it rewrites so much in one go :-)
Quoted 2 lines
(Sorry not to be of any actual help - the oldest sparc machine I have access
Peer review is great - please continue to do so!
Quoted 2 lines
to is an Ultra 5, and even that one is so slow that it makes the simple act of compiling the kernel to test it - really tedious *shrug* :)
I always build my kernels on my snappy Intel box (Intel Atom dual-core). I have a patch to crosstool-ng that I need to dust off and get submitted so it is trivial for others to build sparc toolchains too. But my sparc todo list is growing atm...
Sam