aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2013-02-13 11:21:38 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-02-15 01:02:22 -0500
commitd0c0c9a13f682157e8610565b6125a31d24434bc (patch)
tree2bda07d0384c3a511aabc395658065a61a83a8b9 /arch/powerpc
parentfb09692e71f13af7298eb603a1975850b1c7a8d8 (diff)
powerpc: Add transactional memory unavaliable execption handler
These should never happen since we always turn on MSR TM when in userspace. We don't do lazy TM. Hence if we hit this, we barf and kill the task as something's gone horribly wrong. Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S23
-rw-r--r--arch/powerpc/kernel/traps.c21
2 files changed, 44 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index b9bcf21dbb11..c6b88c1f3ebd 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -336,6 +336,11 @@ vsx_unavailable_pSeries_1:
336 EXCEPTION_PROLOG_0(PACA_EXGEN) 336 EXCEPTION_PROLOG_0(PACA_EXGEN)
337 b vsx_unavailable_pSeries 337 b vsx_unavailable_pSeries
338 338
339 . = 0xf60
340 SET_SCRATCH0(r13)
341 EXCEPTION_PROLOG_0(PACA_EXGEN)
342 b tm_unavailable_pSeries
343
339#ifdef CONFIG_CBE_RAS 344#ifdef CONFIG_CBE_RAS
340 STD_EXCEPTION_HV(0x1200, 0x1202, cbe_system_error) 345 STD_EXCEPTION_HV(0x1200, 0x1202, cbe_system_error)
341 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1202) 346 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1202)
@@ -550,6 +555,8 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206)
550 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20) 555 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20)
551 STD_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) 556 STD_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
552 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40) 557 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40)
558 STD_EXCEPTION_PSERIES_OOL(0xf60, tm_unavailable)
559 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf60)
553 560
554/* 561/*
555 * An interrupt came in while soft-disabled. We set paca->irq_happened, then: 562 * An interrupt came in while soft-disabled. We set paca->irq_happened, then:
@@ -852,6 +859,12 @@ vsx_unavailable_relon_pSeries_1:
852 EXCEPTION_PROLOG_0(PACA_EXGEN) 859 EXCEPTION_PROLOG_0(PACA_EXGEN)
853 b vsx_unavailable_relon_pSeries 860 b vsx_unavailable_relon_pSeries
854 861
862tm_unavailable_relon_pSeries_1:
863 . = 0x4f60
864 SET_SCRATCH0(r13)
865 EXCEPTION_PROLOG_0(PACA_EXGEN)
866 b tm_unavailable_relon_pSeries
867
855 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint) 868 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
856#ifdef CONFIG_PPC_DENORMALISATION 869#ifdef CONFIG_PPC_DENORMALISATION
857 . = 0x5500 870 . = 0x5500
@@ -1202,6 +1215,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1202 b .ret_from_except 1215 b .ret_from_except
1203 1216
1204 .align 7 1217 .align 7
1218 .globl tm_unavailable_common
1219tm_unavailable_common:
1220 EXCEPTION_PROLOG_COMMON(0xf60, PACA_EXGEN)
1221 bl .save_nvgprs
1222 addi r3,r1,STACK_FRAME_OVERHEAD
1223 bl .tm_unavailable_exception
1224 b .ret_from_except
1225
1226 .align 7
1205 .globl __end_handlers 1227 .globl __end_handlers
1206__end_handlers: 1228__end_handlers:
1207 1229
@@ -1220,6 +1242,7 @@ __end_handlers:
1220 STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor) 1242 STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
1221 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) 1243 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
1222 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) 1244 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
1245 STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, tm_unavailable)
1223 1246
1224#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 1247#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
1225/* 1248/*
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index bd5de5deaf51..f829e05d8b1b 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1168,6 +1168,27 @@ void vsx_unavailable_exception(struct pt_regs *regs)
1168 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); 1168 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT);
1169} 1169}
1170 1170
1171void tm_unavailable_exception(struct pt_regs *regs)
1172{
1173 /* We restore the interrupt state now */
1174 if (!arch_irq_disabled_regs(regs))
1175 local_irq_enable();
1176
1177 /* Currently we never expect a TMU exception. Catch
1178 * this and kill the process!
1179 */
1180 printk(KERN_EMERG "Unexpected TM unavailable exception at %lx "
1181 "(msr %lx)\n",
1182 regs->nip, regs->msr);
1183
1184 if (user_mode(regs)) {
1185 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
1186 return;
1187 }
1188
1189 die("Unexpected TM unavailable exception", regs, SIGABRT);
1190}
1191
1171void performance_monitor_exception(struct pt_regs *regs) 1192void performance_monitor_exception(struct pt_regs *regs)
1172{ 1193{
1173 __get_cpu_var(irq_stat).pmu_irqs++; 1194 __get_cpu_var(irq_stat).pmu_irqs++;