]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.45/powerpc-fix-vsx-enabling-flushing-to-also-test-msr_fp-and-msr_vec.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.45 / powerpc-fix-vsx-enabling-flushing-to-also-test-msr_fp-and-msr_vec.patch
1 From 5a69aec945d27e78abac9fd032533d3aaebf7c1e Mon Sep 17 00:00:00 2001
2 From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
3 Date: Wed, 16 Aug 2017 16:01:14 +1000
4 Subject: powerpc: Fix VSX enabling/flushing to also test MSR_FP and MSR_VEC
5
6 From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7
8 commit 5a69aec945d27e78abac9fd032533d3aaebf7c1e upstream.
9
10 VSX uses a combination of the old vector registers, the old FP
11 registers and new "second halves" of the FP registers.
12
13 Thus when we need to see the VSX state in the thread struct
14 (flush_vsx_to_thread()) or when we'll use the VSX in the kernel
15 (enable_kernel_vsx()) we need to ensure they are all flushed into
16 the thread struct if either of them is individually enabled.
17
18 Unfortunately we only tested if the whole VSX was enabled, not if they
19 were individually enabled.
20
21 Fixes: 72cd7b44bc99 ("powerpc: Uncomment and make enable_kernel_vsx() routine available")
22 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
23 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 arch/powerpc/kernel/process.c | 5 +++--
28 1 file changed, 3 insertions(+), 2 deletions(-)
29
30 --- a/arch/powerpc/kernel/process.c
31 +++ b/arch/powerpc/kernel/process.c
32 @@ -359,7 +359,8 @@ void enable_kernel_vsx(void)
33
34 cpumsr = msr_check_and_set(MSR_FP|MSR_VEC|MSR_VSX);
35
36 - if (current->thread.regs && (current->thread.regs->msr & MSR_VSX)) {
37 + if (current->thread.regs &&
38 + (current->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP))) {
39 check_if_tm_restore_required(current);
40 /*
41 * If a thread has already been reclaimed then the
42 @@ -383,7 +384,7 @@ void flush_vsx_to_thread(struct task_str
43 {
44 if (tsk->thread.regs) {
45 preempt_disable();
46 - if (tsk->thread.regs->msr & MSR_VSX) {
47 + if (tsk->thread.regs->msr & (MSR_VSX|MSR_VEC|MSR_FP)) {
48 BUG_ON(tsk != current);
49 giveup_vsx(tsk);
50 }