提交 cfac5784 编写于 作者: S Scott Wood 提交者: Avi Kivity

powerpc/booke: Provide exception macros with interrupt name

DO_KVM will need to identify the particular exception type.

There is an existing set of arbitrary numbers that Linux passes,
but it's an undocumented mess that sort of corresponds to server/classic
exception vectors but not really.
Signed-off-by: NScott Wood <scottwood@freescale.com>
Signed-off-by: NAlexander Graf <agraf@suse.de>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 ab9fc405
...@@ -248,10 +248,11 @@ _ENTRY(_start); ...@@ -248,10 +248,11 @@ _ENTRY(_start);
interrupt_base: interrupt_base:
/* Critical Input Interrupt */ /* Critical Input Interrupt */
CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception) CRITICAL_EXCEPTION(0x0100, CRITICAL, CriticalInput, unknown_exception)
/* Machine Check Interrupt */ /* Machine Check Interrupt */
CRITICAL_EXCEPTION(0x0200, MachineCheck, machine_check_exception) CRITICAL_EXCEPTION(0x0200, MACHINE_CHECK, MachineCheck, \
machine_check_exception)
MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception) MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception)
/* Data Storage Interrupt */ /* Data Storage Interrupt */
...@@ -261,7 +262,8 @@ interrupt_base: ...@@ -261,7 +262,8 @@ interrupt_base:
INSTRUCTION_STORAGE_EXCEPTION INSTRUCTION_STORAGE_EXCEPTION
/* External Input Interrupt */ /* External Input Interrupt */
EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE) EXCEPTION(0x0500, BOOKE_INTERRUPT_EXTERNAL, ExternalInput, \
do_IRQ, EXC_XFER_LITE)
/* Alignment Interrupt */ /* Alignment Interrupt */
ALIGNMENT_EXCEPTION ALIGNMENT_EXCEPTION
...@@ -273,29 +275,32 @@ interrupt_base: ...@@ -273,29 +275,32 @@ interrupt_base:
#ifdef CONFIG_PPC_FPU #ifdef CONFIG_PPC_FPU
FP_UNAVAILABLE_EXCEPTION FP_UNAVAILABLE_EXCEPTION
#else #else
EXCEPTION(0x2010, FloatingPointUnavailable, unknown_exception, EXC_XFER_EE) EXCEPTION(0x2010, BOOKE_INTERRUPT_FP_UNAVAIL, \
FloatingPointUnavailable, unknown_exception, EXC_XFER_EE)
#endif #endif
/* System Call Interrupt */ /* System Call Interrupt */
START_EXCEPTION(SystemCall) START_EXCEPTION(SystemCall)
NORMAL_EXCEPTION_PROLOG NORMAL_EXCEPTION_PROLOG(BOOKE_INTERRUPT_SYSCALL)
EXC_XFER_EE_LITE(0x0c00, DoSyscall) EXC_XFER_EE_LITE(0x0c00, DoSyscall)
/* Auxiliary Processor Unavailable Interrupt */ /* Auxiliary Processor Unavailable Interrupt */
EXCEPTION(0x2020, AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_EE) EXCEPTION(0x2020, BOOKE_INTERRUPT_AP_UNAVAIL, \
AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_EE)
/* Decrementer Interrupt */ /* Decrementer Interrupt */
DECREMENTER_EXCEPTION DECREMENTER_EXCEPTION
/* Fixed Internal Timer Interrupt */ /* Fixed Internal Timer Interrupt */
/* TODO: Add FIT support */ /* TODO: Add FIT support */
EXCEPTION(0x1010, FixedIntervalTimer, unknown_exception, EXC_XFER_EE) EXCEPTION(0x1010, BOOKE_INTERRUPT_FIT, FixedIntervalTimer, \
unknown_exception, EXC_XFER_EE)
/* Watchdog Timer Interrupt */ /* Watchdog Timer Interrupt */
/* TODO: Add watchdog support */ /* TODO: Add watchdog support */
#ifdef CONFIG_BOOKE_WDT #ifdef CONFIG_BOOKE_WDT
CRITICAL_EXCEPTION(0x1020, WatchdogTimer, WatchdogException) CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, WatchdogException)
#else #else
CRITICAL_EXCEPTION(0x1020, WatchdogTimer, unknown_exception) CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, unknown_exception)
#endif #endif
/* Data TLB Error Interrupt */ /* Data TLB Error Interrupt */
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#define __HEAD_BOOKE_H__ #define __HEAD_BOOKE_H__
#include <asm/ptrace.h> /* for STACK_FRAME_REGS_MARKER */ #include <asm/ptrace.h> /* for STACK_FRAME_REGS_MARKER */
#include <asm/kvm_asm.h>
/* /*
* Macros used for common Book-e exception handling * Macros used for common Book-e exception handling
*/ */
...@@ -28,7 +30,7 @@ ...@@ -28,7 +30,7 @@
*/ */
#define THREAD_NORMSAVE(offset) (THREAD_NORMSAVES + (offset * 4)) #define THREAD_NORMSAVE(offset) (THREAD_NORMSAVES + (offset * 4))
#define NORMAL_EXCEPTION_PROLOG \ #define NORMAL_EXCEPTION_PROLOG(intno) \
mtspr SPRN_SPRG_WSCRATCH0, r10; /* save one register */ \ mtspr SPRN_SPRG_WSCRATCH0, r10; /* save one register */ \
mfspr r10, SPRN_SPRG_THREAD; \ mfspr r10, SPRN_SPRG_THREAD; \
stw r11, THREAD_NORMSAVE(0)(r10); \ stw r11, THREAD_NORMSAVE(0)(r10); \
...@@ -113,7 +115,7 @@ ...@@ -113,7 +115,7 @@
* registers as the normal prolog above. Instead we use a portion of the * registers as the normal prolog above. Instead we use a portion of the
* critical/machine check exception stack at low physical addresses. * critical/machine check exception stack at low physical addresses.
*/ */
#define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, exc_level_srr0, exc_level_srr1) \ #define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, intno, exc_level_srr0, exc_level_srr1) \
mtspr SPRN_SPRG_WSCRATCH_##exc_level,r8; \ mtspr SPRN_SPRG_WSCRATCH_##exc_level,r8; \
BOOKE_LOAD_EXC_LEVEL_STACK(exc_level);/* r8 points to the exc_level stack*/ \ BOOKE_LOAD_EXC_LEVEL_STACK(exc_level);/* r8 points to the exc_level stack*/ \
stw r9,GPR9(r8); /* save various registers */\ stw r9,GPR9(r8); /* save various registers */\
...@@ -162,12 +164,13 @@ ...@@ -162,12 +164,13 @@
SAVE_4GPRS(3, r11); \ SAVE_4GPRS(3, r11); \
SAVE_2GPRS(7, r11) SAVE_2GPRS(7, r11)
#define CRITICAL_EXCEPTION_PROLOG \ #define CRITICAL_EXCEPTION_PROLOG(intno) \
EXC_LEVEL_EXCEPTION_PROLOG(CRIT, SPRN_CSRR0, SPRN_CSRR1) EXC_LEVEL_EXCEPTION_PROLOG(CRIT, intno, SPRN_CSRR0, SPRN_CSRR1)
#define DEBUG_EXCEPTION_PROLOG \ #define DEBUG_EXCEPTION_PROLOG \
EXC_LEVEL_EXCEPTION_PROLOG(DBG, SPRN_DSRR0, SPRN_DSRR1) EXC_LEVEL_EXCEPTION_PROLOG(DBG, DEBUG, SPRN_DSRR0, SPRN_DSRR1)
#define MCHECK_EXCEPTION_PROLOG \ #define MCHECK_EXCEPTION_PROLOG \
EXC_LEVEL_EXCEPTION_PROLOG(MC, SPRN_MCSRR0, SPRN_MCSRR1) EXC_LEVEL_EXCEPTION_PROLOG(MC, MACHINE_CHECK, \
SPRN_MCSRR0, SPRN_MCSRR1)
/* /*
* Exception vectors. * Exception vectors.
...@@ -181,16 +184,16 @@ ...@@ -181,16 +184,16 @@
.long func; \ .long func; \
.long ret_from_except_full .long ret_from_except_full
#define EXCEPTION(n, label, hdlr, xfer) \ #define EXCEPTION(n, intno, label, hdlr, xfer) \
START_EXCEPTION(label); \ START_EXCEPTION(label); \
NORMAL_EXCEPTION_PROLOG; \ NORMAL_EXCEPTION_PROLOG(intno); \
addi r3,r1,STACK_FRAME_OVERHEAD; \ addi r3,r1,STACK_FRAME_OVERHEAD; \
xfer(n, hdlr) xfer(n, hdlr)
#define CRITICAL_EXCEPTION(n, label, hdlr) \ #define CRITICAL_EXCEPTION(n, intno, label, hdlr) \
START_EXCEPTION(label); \ START_EXCEPTION(label); \
CRITICAL_EXCEPTION_PROLOG; \ CRITICAL_EXCEPTION_PROLOG(intno); \
addi r3,r1,STACK_FRAME_OVERHEAD; \ addi r3,r1,STACK_FRAME_OVERHEAD; \
EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \ EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
NOCOPY, crit_transfer_to_handler, \ NOCOPY, crit_transfer_to_handler, \
ret_from_crit_exc) ret_from_crit_exc)
...@@ -302,7 +305,7 @@ ...@@ -302,7 +305,7 @@
#define DEBUG_CRIT_EXCEPTION \ #define DEBUG_CRIT_EXCEPTION \
START_EXCEPTION(DebugCrit); \ START_EXCEPTION(DebugCrit); \
CRITICAL_EXCEPTION_PROLOG; \ CRITICAL_EXCEPTION_PROLOG(DEBUG); \
\ \
/* \ /* \
* If there is a single step or branch-taken exception in an \ * If there is a single step or branch-taken exception in an \
...@@ -355,7 +358,7 @@ ...@@ -355,7 +358,7 @@
#define DATA_STORAGE_EXCEPTION \ #define DATA_STORAGE_EXCEPTION \
START_EXCEPTION(DataStorage) \ START_EXCEPTION(DataStorage) \
NORMAL_EXCEPTION_PROLOG; \ NORMAL_EXCEPTION_PROLOG(DATA_STORAGE); \
mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \ mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \
stw r5,_ESR(r11); \ stw r5,_ESR(r11); \
mfspr r4,SPRN_DEAR; /* Grab the DEAR */ \ mfspr r4,SPRN_DEAR; /* Grab the DEAR */ \
...@@ -363,7 +366,7 @@ ...@@ -363,7 +366,7 @@
#define INSTRUCTION_STORAGE_EXCEPTION \ #define INSTRUCTION_STORAGE_EXCEPTION \
START_EXCEPTION(InstructionStorage) \ START_EXCEPTION(InstructionStorage) \
NORMAL_EXCEPTION_PROLOG; \ NORMAL_EXCEPTION_PROLOG(INST_STORAGE); \
mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \ mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \
stw r5,_ESR(r11); \ stw r5,_ESR(r11); \
mr r4,r12; /* Pass SRR0 as arg2 */ \ mr r4,r12; /* Pass SRR0 as arg2 */ \
...@@ -372,7 +375,7 @@ ...@@ -372,7 +375,7 @@
#define ALIGNMENT_EXCEPTION \ #define ALIGNMENT_EXCEPTION \
START_EXCEPTION(Alignment) \ START_EXCEPTION(Alignment) \
NORMAL_EXCEPTION_PROLOG; \ NORMAL_EXCEPTION_PROLOG(ALIGNMENT); \
mfspr r4,SPRN_DEAR; /* Grab the DEAR and save it */ \ mfspr r4,SPRN_DEAR; /* Grab the DEAR and save it */ \
stw r4,_DEAR(r11); \ stw r4,_DEAR(r11); \
addi r3,r1,STACK_FRAME_OVERHEAD; \ addi r3,r1,STACK_FRAME_OVERHEAD; \
...@@ -380,7 +383,7 @@ ...@@ -380,7 +383,7 @@
#define PROGRAM_EXCEPTION \ #define PROGRAM_EXCEPTION \
START_EXCEPTION(Program) \ START_EXCEPTION(Program) \
NORMAL_EXCEPTION_PROLOG; \ NORMAL_EXCEPTION_PROLOG(PROGRAM); \
mfspr r4,SPRN_ESR; /* Grab the ESR and save it */ \ mfspr r4,SPRN_ESR; /* Grab the ESR and save it */ \
stw r4,_ESR(r11); \ stw r4,_ESR(r11); \
addi r3,r1,STACK_FRAME_OVERHEAD; \ addi r3,r1,STACK_FRAME_OVERHEAD; \
...@@ -388,7 +391,7 @@ ...@@ -388,7 +391,7 @@
#define DECREMENTER_EXCEPTION \ #define DECREMENTER_EXCEPTION \
START_EXCEPTION(Decrementer) \ START_EXCEPTION(Decrementer) \
NORMAL_EXCEPTION_PROLOG; \ NORMAL_EXCEPTION_PROLOG(DECREMENTER); \
lis r0,TSR_DIS@h; /* Setup the DEC interrupt mask */ \ lis r0,TSR_DIS@h; /* Setup the DEC interrupt mask */ \
mtspr SPRN_TSR,r0; /* Clear the DEC interrupt */ \ mtspr SPRN_TSR,r0; /* Clear the DEC interrupt */ \
addi r3,r1,STACK_FRAME_OVERHEAD; \ addi r3,r1,STACK_FRAME_OVERHEAD; \
...@@ -396,7 +399,7 @@ ...@@ -396,7 +399,7 @@
#define FP_UNAVAILABLE_EXCEPTION \ #define FP_UNAVAILABLE_EXCEPTION \
START_EXCEPTION(FloatingPointUnavailable) \ START_EXCEPTION(FloatingPointUnavailable) \
NORMAL_EXCEPTION_PROLOG; \ NORMAL_EXCEPTION_PROLOG(FP_UNAVAIL); \
beq 1f; \ beq 1f; \
bl load_up_fpu; /* if from user, just load it up */ \ bl load_up_fpu; /* if from user, just load it up */ \
b fast_exception_return; \ b fast_exception_return; \
......
...@@ -301,19 +301,20 @@ _ENTRY(__early_start) ...@@ -301,19 +301,20 @@ _ENTRY(__early_start)
interrupt_base: interrupt_base:
/* Critical Input Interrupt */ /* Critical Input Interrupt */
CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception) CRITICAL_EXCEPTION(0x0100, CRITICAL, CriticalInput, unknown_exception)
/* Machine Check Interrupt */ /* Machine Check Interrupt */
#ifdef CONFIG_E200 #ifdef CONFIG_E200
/* no RFMCI, MCSRRs on E200 */ /* no RFMCI, MCSRRs on E200 */
CRITICAL_EXCEPTION(0x0200, MachineCheck, machine_check_exception) CRITICAL_EXCEPTION(0x0200, MACHINE_CHECK, MachineCheck, \
machine_check_exception)
#else #else
MCHECK_EXCEPTION(0x0200, MachineCheck, machine_check_exception) MCHECK_EXCEPTION(0x0200, MachineCheck, machine_check_exception)
#endif #endif
/* Data Storage Interrupt */ /* Data Storage Interrupt */
START_EXCEPTION(DataStorage) START_EXCEPTION(DataStorage)
NORMAL_EXCEPTION_PROLOG NORMAL_EXCEPTION_PROLOG(DATA_STORAGE)
mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */ mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */
stw r5,_ESR(r11) stw r5,_ESR(r11)
mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */ mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
...@@ -328,7 +329,7 @@ interrupt_base: ...@@ -328,7 +329,7 @@ interrupt_base:
INSTRUCTION_STORAGE_EXCEPTION INSTRUCTION_STORAGE_EXCEPTION
/* External Input Interrupt */ /* External Input Interrupt */
EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE) EXCEPTION(0x0500, EXTERNAL, ExternalInput, do_IRQ, EXC_XFER_LITE)
/* Alignment Interrupt */ /* Alignment Interrupt */
ALIGNMENT_EXCEPTION ALIGNMENT_EXCEPTION
...@@ -342,32 +343,36 @@ interrupt_base: ...@@ -342,32 +343,36 @@ interrupt_base:
#else #else
#ifdef CONFIG_E200 #ifdef CONFIG_E200
/* E200 treats 'normal' floating point instructions as FP Unavail exception */ /* E200 treats 'normal' floating point instructions as FP Unavail exception */
EXCEPTION(0x0800, FloatingPointUnavailable, program_check_exception, EXC_XFER_EE) EXCEPTION(0x0800, FP_UNAVAIL, FloatingPointUnavailable, \
program_check_exception, EXC_XFER_EE)
#else #else
EXCEPTION(0x0800, FloatingPointUnavailable, unknown_exception, EXC_XFER_EE) EXCEPTION(0x0800, FP_UNAVAIL, FloatingPointUnavailable, \
unknown_exception, EXC_XFER_EE)
#endif #endif
#endif #endif
/* System Call Interrupt */ /* System Call Interrupt */
START_EXCEPTION(SystemCall) START_EXCEPTION(SystemCall)
NORMAL_EXCEPTION_PROLOG NORMAL_EXCEPTION_PROLOG(SYSCALL)
EXC_XFER_EE_LITE(0x0c00, DoSyscall) EXC_XFER_EE_LITE(0x0c00, DoSyscall)
/* Auxiliary Processor Unavailable Interrupt */ /* Auxiliary Processor Unavailable Interrupt */
EXCEPTION(0x2900, AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_EE) EXCEPTION(0x2900, AP_UNAVAIL, AuxillaryProcessorUnavailable, \
unknown_exception, EXC_XFER_EE)
/* Decrementer Interrupt */ /* Decrementer Interrupt */
DECREMENTER_EXCEPTION DECREMENTER_EXCEPTION
/* Fixed Internal Timer Interrupt */ /* Fixed Internal Timer Interrupt */
/* TODO: Add FIT support */ /* TODO: Add FIT support */
EXCEPTION(0x3100, FixedIntervalTimer, unknown_exception, EXC_XFER_EE) EXCEPTION(0x3100, FIT, FixedIntervalTimer, \
unknown_exception, EXC_XFER_EE)
/* Watchdog Timer Interrupt */ /* Watchdog Timer Interrupt */
#ifdef CONFIG_BOOKE_WDT #ifdef CONFIG_BOOKE_WDT
CRITICAL_EXCEPTION(0x3200, WatchdogTimer, WatchdogException) CRITICAL_EXCEPTION(0x3200, WATCHDOG, WatchdogTimer, WatchdogException)
#else #else
CRITICAL_EXCEPTION(0x3200, WatchdogTimer, unknown_exception) CRITICAL_EXCEPTION(0x3200, WATCHDOG, WatchdogTimer, unknown_exception)
#endif #endif
/* Data TLB Error Interrupt */ /* Data TLB Error Interrupt */
...@@ -538,31 +543,38 @@ interrupt_base: ...@@ -538,31 +543,38 @@ interrupt_base:
#ifdef CONFIG_SPE #ifdef CONFIG_SPE
/* SPE Unavailable */ /* SPE Unavailable */
START_EXCEPTION(SPEUnavailable) START_EXCEPTION(SPEUnavailable)
NORMAL_EXCEPTION_PROLOG NORMAL_EXCEPTION_PROLOG(SPE_UNAVAIL)
bne load_up_spe bne load_up_spe
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
EXC_XFER_EE_LITE(0x2010, KernelSPE) EXC_XFER_EE_LITE(0x2010, KernelSPE)
#else #else
EXCEPTION(0x2020, SPEUnavailable, unknown_exception, EXC_XFER_EE) EXCEPTION(0x2020, SPE_UNAVAIL, SPEUnavailable, \
unknown_exception, EXC_XFER_EE)
#endif /* CONFIG_SPE */ #endif /* CONFIG_SPE */
/* SPE Floating Point Data */ /* SPE Floating Point Data */
#ifdef CONFIG_SPE #ifdef CONFIG_SPE
EXCEPTION(0x2030, SPEFloatingPointData, SPEFloatingPointException, EXC_XFER_EE); EXCEPTION(0x2030, SPE_FP_DATA, SPEFloatingPointData, \
SPEFloatingPointException, EXC_XFER_EE);
/* SPE Floating Point Round */ /* SPE Floating Point Round */
EXCEPTION(0x2050, SPEFloatingPointRound, SPEFloatingPointRoundException, EXC_XFER_EE) EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \
SPEFloatingPointRoundException, EXC_XFER_EE)
#else #else
EXCEPTION(0x2040, SPEFloatingPointData, unknown_exception, EXC_XFER_EE) EXCEPTION(0x2040, SPE_FP_DATA, SPEFloatingPointData, \
EXCEPTION(0x2050, SPEFloatingPointRound, unknown_exception, EXC_XFER_EE) unknown_exception, EXC_XFER_EE)
EXCEPTION(0x2050, SPE_FP_ROUND, SPEFloatingPointRound, \
unknown_exception, EXC_XFER_EE)
#endif /* CONFIG_SPE */ #endif /* CONFIG_SPE */
/* Performance Monitor */ /* Performance Monitor */
EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD) EXCEPTION(0x2060, PERFORMANCE_MONITOR, PerformanceMonitor, \
performance_monitor_exception, EXC_XFER_STD)
EXCEPTION(0x2070, Doorbell, doorbell_exception, EXC_XFER_STD) EXCEPTION(0x2070, DOORBELL, Doorbell, doorbell_exception, EXC_XFER_STD)
CRITICAL_EXCEPTION(0x2080, CriticalDoorbell, unknown_exception) CRITICAL_EXCEPTION(0x2080, DOORBELL_CRITICAL, \
CriticalDoorbell, unknown_exception)
/* Debug Interrupt */ /* Debug Interrupt */
DEBUG_DEBUG_EXCEPTION DEBUG_DEBUG_EXCEPTION
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册