switching MCA handling by machvecs
PATCH 1/1 switching MCA handling by machvecs
This patch enables switching MCA handlers by machvecs. Detail is as follows. Definitely your comment is always welcomed.
[Outline]:
This patch arranges calling each MCA/INIT/CMC/CPE handlers in arch/ia64/kernel/mca.c to refer definition in machvecs. In the beginning of mca.c, there is a "#ifndef PLATFORM_MCA_HANDLERS" block which includes:
mca_handler_platform
ia64_mca_cpe_int_handler
init_handler_platform
ia64_mca_init_platform
and the outside of the block includes:
ia64_mca_cmc_int_handler
Each of these functions is assigned as a default that called when the platform specific handler was not defined in machvecs. Therefor, I delete "#ifndef" to compile all of these function independently of the situation whether PLATFORM_MCA_HANDLERS is defined or not.
[Modified Sources]:
- arch/ia64/kernel/mca.c
- include/asm-ia64/machvec.h
Thanks.
------
H.Seto <[email protected]>
------
diff -Nur linux-2.6.0-test9.org/arch/ia64/kernel/mca.c linux-2.6.0-test9/arch/ia64/kernel/mca.c
--- linux-2.6.0-test9.org/arch/ia64/kernel/mca.c 2003-10-26 03:43:35.000000000 +0900
+++ linux-2.6.0-test9/arch/ia64/kernel/mca.c 2003-11-17 11:22:46.354039217 +0900 @@ -90,7 +90,7 @@
extern struct hw_interrupt_type irq_type_iosapic_level;
static struct irqaction cmci_irqaction = {
- .handler = ia64_mca_cmc_int_handler,
+ .handler = platform_cmci_handler,
.flags = SA_INTERRUPT,
.name = "cmc_hndlr"
};
@@ -115,7 +115,7 @@
#ifdef CONFIG_ACPI
static struct irqaction mca_cpe_irqaction = {
- .handler = ia64_mca_cpe_int_handler,
+ .handler = platform_cpei_handler,
.flags = SA_INTERRUPT,
.name = "cpe_hndlr"
};
@@ -184,9 +184,8 @@
}
/*
- * platform dependent error handling
+ * platform dependent error handling (default)
*/
-#ifndef PLATFORM_MCA_HANDLERS
void
mca_handler_platform (void)
{
@@ -461,8 +460,6 @@
}
#endif /* CONFIG_ACPI */
-#endif /* PLATFORM_MCA_HANDLERS */
-
/*
* ia64_mca_cmc_vector_setup
*
@@ -971,7 +968,7 @@
* Do Platform-specific mca error handling if required. */
if (platform_err)
- mca_handler_platform();
+ platform_mca_handler();
/*
* Wakeup all the processors which are spinning in the rendezvous
@@ -1200,7 +1197,7 @@
if (start_count = -1)
start_count = IA64_LOG_COUNT(SAL_INFO_TYPE_CPE);
- ia64_mca_cpe_int_handler(cpe_irq, arg, ptregs);
+ platform_cpei_handler(cpe_irq, arg, ptregs);
for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
@@ -1302,7 +1299,7 @@
*/
ms = (pal_min_state_area_t *)(ia64_sal_to_os_handoff_state.pal_min_state |
(6ul<<61));
- init_handler_platform(ms, pt, sw); /* call platform specific routines */
+ platform_init_handler(ms, pt, sw); /* call platform specific routines */ }
/*
diff -Nur linux-2.6.0-test9.org/include/asm-ia64/machvec.h linux-2.6.0-test9/include/asm-ia64/machvec.h
--- linux-2.6.0-test9.org/include/asm-ia64/machvec.h 2003-10-26 03:43:47.000000000 +0900
+++ linux-2.6.0-test9/include/asm-ia64/machvec.h 2003-11-14 19:06:08.463319154 +0900
@@ -12,6 +12,8 @@
#include <linux/config.h>
#include <linux/types.h>
+#include <asm/ptrace.h>
+#include <asm/pal.h>
/* forward declarations: */
struct device;
@@ -24,8 +26,10 @@
typedef void ia64_mv_cpu_init_t(void);
typedef void ia64_mv_irq_init_t (void);
typedef void ia64_mv_mca_init_t (void);
+typedef void ia64_mv_init_handler_t (pal_min_state_area_t *, struct pt_regs *, struct switch_stack *);
typedef void ia64_mv_mca_handler_t (void);
typedef void ia64_mv_cmci_handler_t (int, void *, struct pt_regs *);
+typedef void ia64_mv_cpei_handler_t (int, void *, struct pt_regs *);
typedef void ia64_mv_log_print_t (void);
typedef void ia64_mv_send_ipi_t (int, int, int, int);
typedef void ia64_mv_global_tlb_purge_t (unsigned long, unsigned long, unsigned
long);
@@ -86,8 +90,10 @@
# define platform_cpu_init ia64_mv.cpu_init # define platform_irq_init ia64_mv.irq_init # define platform_mca_init ia64_mv.mca_init +# define platform_init_handler ia64_mv.init_handler # define platform_mca_handler ia64_mv.mca_handler # define platform_cmci_handler ia64_mv.cmci_handler +# define platform_cpei_handler ia64_mv.cpei_handler # define platform_log_print ia64_mv.log_print # define platform_send_ipi ia64_mv.send_ipi # define platform_global_tlb_purge ia64_mv.global_tlb_purge
@@ -127,8 +133,10 @@
ia64_mv_cpu_init_t *cpu_init;
ia64_mv_irq_init_t *irq_init;
ia64_mv_mca_init_t *mca_init;
+ ia64_mv_init_handler_t *init_handler;
ia64_mv_mca_handler_t *mca_handler;
ia64_mv_cmci_handler_t *cmci_handler;
+ ia64_mv_cpei_handler_t *cpei_handler;
ia64_mv_log_print_t *log_print;
ia64_mv_send_ipi_t *send_ipi;
ia64_mv_global_tlb_purge_t *global_tlb_purge;
@@ -164,8 +172,10 @@
platform_cpu_init, \ platform_irq_init, \ platform_mca_init, \
+ platform_init_handler, \
platform_mca_handler, \
platform_cmci_handler, \
+ platform_cpei_handler, \
platform_log_print, \
platform_send_ipi, \
platform_global_tlb_purge, \
@@ -229,13 +239,19 @@
# define platform_irq_init ((ia64_mv_irq_init_t *) machvec_noop) #endif #ifndef platform_mca_init -# define platform_mca_init ((ia64_mv_mca_init_t *) machvec_noop) +# define platform_mca_init ia64_mca_init_platform +#endif +#ifndef platform_init_handler +# define platform_init_handler init_handler_platform #endif #ifndef platform_mca_handler -# define platform_mca_handler ((ia64_mv_mca_handler_t *) machvec_noop) +# define platform_mca_handler mca_handler_platform #endif #ifndef platform_cmci_handler -# define platform_cmci_handler ((ia64_mv_cmci_handler_t *) machvec_noop) +# define platform_cmci_handler ia64_mca_cmc_int_handler +#endif +#ifndef platform_cpei_handler +# define platform_cpei_handler ia64_mca_cpe_int_handler #endif #ifndef platform_log_print # define platform_log_print ((ia64_mv_log_print_t *) machvec_noop)
PATCH 1/1 switching MCA handling by machvecs [1/2]
Hi,
Sorry, I had made a careless miss on previous patch code. Here is a modified version.
This is a trial patch that helps platform to having special MCA handlers. You can choose handler between platform specific one and default one by well defined machvecs linked to your platform.
I think this is just a part of what machvecs originally intend to implement, and also think this encourages many ambitious platform venders.
I would appreciate if you give me your comment.
Thanks.
------
H.Seto <[email protected]>
------
arch/ia64/kernel/mca.c 2003-12-03 18:18:06.090569935 +0900 renamed from arch/ia64/kernel/mca.c 2003-11-27 05:44:02.000000000 +0900 +8 -11
@@ -90,7 +90,7 @@ extern struct hw_interrupt_type irq_type_iosapic_level; static struct irqaction cmci_irqaction = { - .handler = ia64_mca_cmc_int_handler, + .handler = platform_cmci_handler_name, .flags = SA_INTERRUPT, .name = "cmc_hndlr" };
@@ -115,7 +115,7 @@ #ifdef CONFIG_ACPI static struct irqaction mca_cpe_irqaction = { - .handler = ia64_mca_cpe_int_handler, + .handler = platform_cpei_handler_name, .flags = SA_INTERRUPT, .name = "cpe_hndlr" };
@@ -186,9 +186,8 @@ /* * platform dependent error handling */ -#ifndef PLATFORM_MCA_HANDLERS void -mca_handler_platform (void) +ia64_mca_handler_platform (void) { }
@@ -346,8 +345,8 @@ } void -init_handler_platform (pal_min_state_area_t *ms, - struct pt_regs *pt, struct switch_stack *sw) +ia64_init_handler_platform (pal_min_state_area_t *ms, + struct pt_regs *pt, struct switch_stack *sw) { struct unw_frame_info info;
@@ -461,8 +460,6 @@ } #endif /* CONFIG_ACPI */ -#endif /* PLATFORM_MCA_HANDLERS */ - /* * ia64_mca_cmc_vector_setup *
@@ -971,7 +968,7 @@ * Do Platform-specific mca error handling if required. */ if (platform_err) - mca_handler_platform(); + platform_mca_handler(); /* * Wakeup all the processors which are spinning in the rendezvous
@@ -1200,7 +1197,7 @@ if (start_count = -1) start_count = IA64_LOG_COUNT(SAL_INFO_TYPE_CPE); - ia64_mca_cpe_int_handler(cpe_irq, arg, ptregs); + platform_cpei_handler(cpe_irq, arg, ptregs); for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
@@ -1302,7 +1299,7 @@ */ ms = (pal_min_state_area_t *)(ia64_sal_to_os_handoff_state.pal_min_state | (6ul<<61)); - init_handler_platform(ms, pt, sw); /* call platform specific routines */ + platform_init_handler(ms, pt, sw); /* call platform specific routines */ } /*
include/asm-ia64/machvec.h 2003-12-03 18:18:06.091546497 +0900 renamed from include/asm-ia64/machvec.h 2003-11-27 05:44:18.000000000 +0900 +28 -3
@@ -12,6 +12,8 @@ #include <linux/config.h> #include <linux/types.h> +#include <asm/ptrace.h> +#include <asm/pal.h> /* forward declarations: */ struct device;
@@ -23,9 +25,11 @@ typedef void ia64_mv_setup_t (char **); typedef void ia64_mv_cpu_init_t(void); typedef void ia64_mv_irq_init_t (void); +typedef void ia64_mv_init_handler_t (pal_min_state_area_t *, struct pt_regs *, struct switch_stack *); typedef void ia64_mv_mca_init_t (void); typedef void ia64_mv_mca_handler_t (void); typedef void ia64_mv_cmci_handler_t (int, void *, struct pt_regs *); +typedef void ia64_mv_cpei_handler_t (int, void *, struct pt_regs *); typedef void ia64_mv_log_print_t (void); typedef void ia64_mv_send_ipi_t (int, int, int, int); typedef void ia64_mv_global_tlb_purge_t (unsigned long, unsigned long, unsigned long);
@@ -67,6 +71,9 @@ extern void machvec_noop (void); extern void machvec_memory_fence (void); +extern void ia64_init_handler_platform (pal_min_state_area_t *, struct pt_regs *, struct switch_stack *); +extern void ia64_mca_init_platform (void); +extern void ia64_mca_handler_platform (void); # if defined (CONFIG_IA64_HP_SIM) # include <asm/machvec_hpsim.h>
@@ -85,9 +92,15 @@ # define platform_setup ia64_mv.setup # define platform_cpu_init ia64_mv.cpu_init # define platform_irq_init ia64_mv.irq_init +# define platform_init_handler ia64_mv.init_handler # define platform_mca_init ia64_mv.mca_init # define platform_mca_handler ia64_mv.mca_handler # define platform_cmci_handler ia64_mv.cmci_handler +# define platform_cmci_handler_name \ + (irqreturn_t (*)(int,void *,struct pt_regs *))(&ia64_mv.cmci_handler) +# define platform_cpei_handler ia64_mv.cpei_handler +# define platform_cpei_handler_name \ + (irqreturn_t (*)(int,void *,struct pt_regs *))(&ia64_mv.cpei_handler) # define platform_log_print ia64_mv.log_print # define platform_send_ipi ia64_mv.send_ipi # define platform_global_tlb_purge ia64_mv.global_tlb_purge
@@ -126,9 +139,11 @@ ia64_mv_setup_t *setup; ia64_mv_cpu_init_t *cpu_init; ia64_mv_irq_init_t *irq_init; + ia64_mv_init_handler_t *init_handler; ia64_mv_mca_init_t *mca_init; ia64_mv_mca_handler_t *mca_handler; ia64_mv_cmci_handler_t *cmci_handler; + ia64_mv_cpei_handler_t *cpei_handler; ia64_mv_log_print_t *log_print; ia64_mv_send_ipi_t *send_ipi; ia64_mv_global_tlb_purge_t *global_tlb_purge;
@@ -163,9 +178,11 @@ platform_setup, \ platform_cpu_init, \ platform_irq_init, \ + platform_init_handler, \ platform_mca_init, \ platform_mca_handler, \ platform_cmci_handler, \ + platform_cpei_handler, \ platform_log_print, \ platform_send_ipi, \ platform_global_tlb_purge, \
@@ -228,14 +245,22 @@ #ifndef platform_irq_init # define platform_irq_init ((ia64_mv_irq_init_t *) machvec_noop) #endif +#ifndef platform_init_handler +# define platform_init_handler ((ia64_mv_init_handler_t *) ia64_init_handler_platform) +#endif #ifndef platform_mca_init -# define platform_mca_init ((ia64_mv_mca_init_t *) machvec_noop) +# define platform_mca_init ((ia64_mv_mca_init_t *) ia64_mca_init_platform) #endif #ifndef platform_mca_handler -# define platform_mca_handler ((ia64_mv_mca_handler_t *) machvec_noop) +# define platform_mca_handler ((ia64_mv_mca_handler_t *) ia64_mca_handler_platform) #endif #ifndef platform_cmci_handler -# define platform_cmci_handler ((ia64_mv_cmci_handler_t *) machvec_noop) +# define platform_cmci_handler ((ia64_mv_cmci_handler_t *) ia64_mca_cmc_int_handler) +# define platform_cmci_handler_name ia64_mca_cmc_int_handler +#endif +#ifndef platform_cpei_handler +# define platform_cpei_handler ((ia64_mv_cpei_handler_t *) ia64_mca_cpe_int_handler) +# define platform_cpei_handler_name ia64_mca_cpe_int_handler #endif #ifndef platform_log_print # define platform_log_print ((ia64_mv_log_print_t *) machvec_noop)
include/asm-ia64/machvec_init.h 2003-12-03 18:18:06.091546497 +0900 renamed from include/asm-ia64/machvec_init.h 2003-11-27 05:42:51.000000000 +0900 +6 -0
@@ -17,6 +17,12 @@ extern ia64_mv_readl_t __ia64_readl; extern ia64_mv_readq_t __ia64_readq; +extern ia64_mv_init_handler_t ia64_init_handler_platform; +extern ia64_mv_mca_init_t ia64_mca_init_platform; +extern ia64_mv_mca_handler_t ia64_mca_handler_platform; +extern ia64_mv_cmci_handler_t ia64_mca_cmc_int_handler; +extern ia64_mv_cpei_handler_t ia64_mca_cpe_int_handler; + #define MACHVEC_HELPER(name) \ struct ia64_machine_vector machvec_##name __attribute__ ((unused, __section__ (".machvec"))) \ = MACHVEC_INIT(name);
PATCH 1/1 switching MCA handling by machvecs [2/2]
In reply to Hidetoshi SetoThe following code is a sample of handler implementation using machvecs for notional platform "AAA".
Thanks.
------
H.Seto <[email protected]>
------
arch/ia64/Kconfig 2003-12-03 18:19:14.702873782 +0900 renamed from arch/ia64/Kconfig 2003-11-27 05:45:39.000000000 +0900 +4 -1
@@ -96,6 +96,9 @@ config IA64_SGI_SN2 bool "SGI-SN2" +config IA64_AAA + bool "AAA" + endchoice choice
@@ -274,7 +277,7 @@ config IOSAPIC bool - depends on IA64_GENERIC || IA64_DIG || IA64_HP_ZX1 || IA64_SGI_SN2 + depends on IA64_GENERIC || IA64_DIG || IA64_HP_ZX1 || IA64_SGI_SN2 || IA64_AAA default y config IA64_SGI_SN_SIM
arch/ia64/Makefile 2003-12-03 18:19:14.702873782 +0900 renamed from arch/ia64/Makefile 2003-11-27 05:42:54.000000000 +0900 +1 -0
@@ -60,6 +60,7 @@ core-$(CONFIG_IA64_GENERIC) += arch/ia64/dig/ core-$(CONFIG_IA64_HP_ZX1) += arch/ia64/dig/ core-$(CONFIG_IA64_SGI_SN2) += arch/ia64/sn/ +core-$(CONFIG_IA64_AAA) += arch/ia64/aaa/ drivers-$(CONFIG_PCI) += arch/ia64/pci/ drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/
arch/ia64/aaa/Makefile 2003-12-03 18:19:14.703850344 +0900 renamed from arch/ia64/aaa/Makefile 1970-01-01 09:00:00.000000000 +0900 +5 -0
@@ -0,0 +1,5 @@ +# +# ia64/platform/aaa/Makefile +# + +obj-y := mca_handler.o
arch/ia64/aaa/mca_handler.c 2003-12-03 18:19:14.703850344 +0900 renamed from arch/ia64/aaa/mca_handler.c 1970-01-01 09:00:00.000000000 +0900 +39 -0
@@ -0,0 +1,39 @@ +/* + * Platform dependent support for AAA platforms. + */ + +#include <linux/interrupt.h> +#include <asm/ptrace.h> +#include <asm/pal.h> + +void +aaa_init_handler_platform +(pal_min_state_area_t *ms, struct pt_regs *pt, struct switch_stack *sw) +{ + +} + +void +aaa_mca_init_platform (void) +{ + +} + +void +aaa_mca_handler_platform (void) +{ + +} + +void +aaa_mca_cmc_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs) +{ + +} + +void +aaa_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs) +{ + +} +
arch/ia64/kernel/acpi.c 2003-12-03 18:19:14.703850344 +0900 renamed from arch/ia64/kernel/acpi.c 2003-11-27 05:44:07.000000000 +0900 +2 -0
@@ -105,6 +105,8 @@ return "sn2"; # elif defined (CONFIG_IA64_DIG) return "dig"; +# elif defined (CONFIG_IA64_AAA) + return "dig"; # else # error Unknown platform. Fix acpi.c. # endif
include/asm-ia64/machvec.h 2003-12-03 18:19:14.704826907 +0900 renamed from include/asm-ia64/machvec.h 2003-12-03 18:18:06.091546497 +0900 +2 -0
@@ -83,6 +83,8 @@ # include <asm/machvec_hpzx1.h> # elif defined (CONFIG_IA64_SGI_SN2) # include <asm/machvec_sn2.h> +# elif defined (CONFIG_IA64_AAA) +# include <asm/machvec_aaa.h> # elif defined (CONFIG_IA64_GENERIC) # ifdef MACHVEC_PLATFORM_HEADER
include/asm-ia64/machvec_aaa.h 2003-12-03 18:19:14.704826907 +0900 renamed from include/asm-ia64/machvec_aaa.h 1970-01-01 09:00:00.000000000 +0900 +21 -0
@@ -0,0 +1,21 @@ +#ifndef _ASM_IA64_MACHVEC_AAA_h +#define _ASM_IA64_MACHVEC_AAA_h + +extern ia64_mv_init_handler_t aaa_init_handler_platform; +extern ia64_mv_mca_init_t aaa_mca_init_platform; +extern ia64_mv_mca_handler_t aaa_mca_handler_platform; +extern ia64_mv_cmci_handler_t aaa_mca_cmc_int_handler; +extern ia64_mv_cpei_handler_t aaa_mca_cpe_int_handler; + +#define platform_name "aaa" +#define platform_init_handler aaa_init_handler_platform +#define platform_mca_init aaa_mca_init_platform +#define platform_mca_handler aaa_mca_handler_platform +#define platform_cmci_handler aaa_mca_cmc_int_handler +#define platform_cmci_handler_name \ + (irqreturn_t (*)(int,void *,struct pt_regs *))(&aaa_mca_cmc_int_handler) +#define platform_cpei_handler aaa_mca_cpe_int_handler +#define platform_cpei_handler_name \ + (irqreturn_t (*)(int,void *,struct pt_regs *))(&aaa_mca_cpe_int_handler) + +#endif /* _ASM_IA64_MACHVEC_AAA_h */