powerpc: Fix emulation of illegal instructions on PowerNV platform
authorPaul Mackerras <paulus@samba.org>
Fri, 14 Jun 2013 10:07:41 +0000 (20:07 +1000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Jun 2013 01:17:02 +0000 (02:17 +0100)
commite4f37de094d8c0a55af0fe63d7f715457b2de3e6
tree7916aacd2ee03cf10a3ba06a20ed7cd479b37530
parent08647d0f99db39f73f37e00ebafc24ff3d3f4948
powerpc: Fix emulation of illegal instructions on PowerNV platform

commit bf593907f7236e95698a76b7c7a2bbf8b1165327 upstream.

Normally, the kernel emulates a few instructions that are unimplemented
on some processors (e.g. the old dcba instruction), or privileged (e.g.
mfpvr).  The emulation of unimplemented instructions is currently not
working on the PowerNV platform.  The reason is that on these machines,
unimplemented and illegal instructions cause a hypervisor emulation
assist interrupt, rather than a program interrupt as on older CPUs.
Our vector for the emulation assist interrupt just calls
program_check_exception() directly, without setting the bit in SRR1
that indicates an illegal instruction interrupt.  This fixes it by
making the emulation assist interrupt set that bit before calling
program_check_interrupt().  With this, old programs that use no-longer
implemented instructions such as dcba now work again.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/powerpc/kernel/exceptions-64s.S
arch/powerpc/kernel/traps.c