]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/powerpc-64s-hash-fix-assert_slb_presence-use-of-the-slbfee.-instruction.patch
Linux 4.19.31
[thirdparty/kernel/stable-queue.git] / queue-5.0 / powerpc-64s-hash-fix-assert_slb_presence-use-of-the-slbfee.-instruction.patch
1 From 7104dccfd052fde51eecc9972dad9c40bd3e0d11 Mon Sep 17 00:00:00 2001
2 From: Nicholas Piggin <npiggin@gmail.com>
3 Date: Fri, 15 Feb 2019 20:20:20 +1000
4 Subject: powerpc/64s/hash: Fix assert_slb_presence() use of the slbfee. instruction
5
6 From: Nicholas Piggin <npiggin@gmail.com>
7
8 commit 7104dccfd052fde51eecc9972dad9c40bd3e0d11 upstream.
9
10 The slbfee. instruction must have bit 24 of RB clear, failure to do
11 so can result in false negatives that result in incorrect assertions.
12
13 This is not obvious from the ISA v3.0B document, which only says:
14
15 The hardware ignores the contents of RB 36:38 40:63 -- p.1032
16
17 This patch fixes the bug and also clears all other bits from PPC bit
18 36-63, which is good practice when dealing with reserved or ignored
19 bits.
20
21 Fixes: e15a4fea4dee ("powerpc/64s/hash: Add some SLB debugging tests")
22 Cc: stable@vger.kernel.org # v4.20+
23 Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
24 Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
25 Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
26 Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
27 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30 ---
31 arch/powerpc/mm/slb.c | 5 +++++
32 1 file changed, 5 insertions(+)
33
34 --- a/arch/powerpc/mm/slb.c
35 +++ b/arch/powerpc/mm/slb.c
36 @@ -69,6 +69,11 @@ static void assert_slb_presence(bool pre
37 if (!cpu_has_feature(CPU_FTR_ARCH_206))
38 return;
39
40 + /*
41 + * slbfee. requires bit 24 (PPC bit 39) be clear in RB. Hardware
42 + * ignores all other bits from 0-27, so just clear them all.
43 + */
44 + ea &= ~((1UL << 28) - 1);
45 asm volatile(__PPC_SLBFEE_DOT(%0, %1) : "=r"(tmp) : "r"(ea) : "cr0");
46
47 WARN_ON(present == (tmp == 0));