android_kernel_motorola_sm6225/arch
Paul Mackerras 9d1ffdd8f3 KVM: PPC: Book3S PR: Don't corrupt guest state when kernel uses VMX
Currently the code assumes that once we load up guest FP/VSX or VMX
state into the CPU, it stays valid in the CPU registers until we
explicitly flush it to the thread_struct.  However, on POWER7,
copy_page() and memcpy() can use VMX.  These functions do flush the
VMX state to the thread_struct before using VMX instructions, but if
this happens while we have guest state in the VMX registers, and we
then re-enter the guest, we don't reload the VMX state from the
thread_struct, leading to guest corruption.  This has been observed
to cause guest processes to segfault.

To fix this, we check before re-entering the guest that all of the
bits corresponding to facilities owned by the guest, as expressed
in vcpu->arch.guest_owned_ext, are set in current->thread.regs->msr.
Any bits that have been cleared correspond to facilities that have
been used by kernel code and thus flushed to the thread_struct, so
for them we reload the state from the thread_struct.

We also need to check current->thread.regs->msr before calling
giveup_fpu() or giveup_altivec(), since if the relevant bit is
clear, the state has already been flushed to the thread_struct and
to flush it again would corrupt it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2013-08-28 16:41:14 +02:00
..
alpha Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
arc ARC changes for 3.11 2013-07-03 11:09:27 -07:00
arm Merge remote-tracking branch 'cmadma/for-v3.12-cma-dma' into kvm-ppc-next 2013-07-08 16:16:56 +02:00
arm64 arm64: KVM: Kconfig integration 2013-07-04 14:40:26 +02:00
avr32 Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
blackfin Driver core patches for 3.11-rc1 2013-07-02 11:44:19 -07:00
c6x Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
cris Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
frv Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
h8300 Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
hexagon consolidate io_remap_pfn_range definitions 2013-06-29 12:46:35 +04:00
ia64 KVM fixes for 3.11 2013-07-03 13:21:40 -07:00
m32r Merge branch 'sched-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:19:24 -07:00
m68k Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
metag Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:15:23 -07:00
microblaze Merge branch 'sched-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:19:24 -07:00
mips Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:17:25 -07:00
mn10300 Merge branch 'sched-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:19:24 -07:00
openrisc Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
parisc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
powerpc KVM: PPC: Book3S PR: Don't corrupt guest state when kernel uses VMX 2013-08-28 16:41:14 +02:00
s390 KVM fixes for 3.11 2013-07-03 13:21:40 -07:00
score Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
sh Merge branch 'core-mutexes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:09:13 -07:00
sparc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-07-03 09:10:19 -07:00
tile Merge branch 'sched-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:19:24 -07:00
um Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-07-02 16:17:25 -07:00
unicore32 Merge branch 'exotic-arch-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2013-07-03 11:12:08 -07:00
x86 KVM: VMX: mark unusable segment as nonpresent 2013-07-04 14:40:36 +02:00
xtensa consolidate io_remap_pfn_range definitions 2013-06-29 12:46:35 +04:00
.gitignore
Kconfig Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-05-15 14:04:00 -07:00