]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/powerpc-rfi-flush-move-the-logic-to-avoid-a-redo-into-the-debugfs-code.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / powerpc-rfi-flush-move-the-logic-to-avoid-a-redo-into-the-debugfs-code.patch
1 From foo@baz Mon 29 Apr 2019 11:38:37 AM CEST
2 From: Michael Ellerman <mpe@ellerman.id.au>
3 Date: Mon, 22 Apr 2019 00:19:50 +1000
4 Subject: powerpc/rfi-flush: Move the logic to avoid a redo into the debugfs code
5 To: stable@vger.kernel.org, gregkh@linuxfoundation.org
6 Cc: linuxppc-dev@ozlabs.org, diana.craciun@nxp.com, msuchanek@suse.de, npiggin@gmail.com, christophe.leroy@c-s.fr
7 Message-ID: <20190421142037.21881-6-mpe@ellerman.id.au>
8
9 From: Michael Ellerman <mpe@ellerman.id.au>
10
11 commit 1e2a9fc7496955faacbbed49461d611b704a7505 upstream.
12
13 rfi_flush_enable() includes a check to see if we're already
14 enabled (or disabled), and in that case does nothing.
15
16 But that means calling setup_rfi_flush() a 2nd time doesn't actually
17 work, which is a bit confusing.
18
19 Move that check into the debugfs code, where it really belongs.
20
21 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
22 Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
23 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 arch/powerpc/kernel/setup_64.c | 13 ++++++++-----
27 1 file changed, 8 insertions(+), 5 deletions(-)
28
29 --- a/arch/powerpc/kernel/setup_64.c
30 +++ b/arch/powerpc/kernel/setup_64.c
31 @@ -873,9 +873,6 @@ static void do_nothing(void *unused)
32
33 void rfi_flush_enable(bool enable)
34 {
35 - if (rfi_flush == enable)
36 - return;
37 -
38 if (enable) {
39 do_rfi_flush_fixups(enabled_flush_types);
40 on_each_cpu(do_nothing, NULL, 1);
41 @@ -929,13 +926,19 @@ void __init setup_rfi_flush(enum l1d_flu
42 #ifdef CONFIG_DEBUG_FS
43 static int rfi_flush_set(void *data, u64 val)
44 {
45 + bool enable;
46 +
47 if (val == 1)
48 - rfi_flush_enable(true);
49 + enable = true;
50 else if (val == 0)
51 - rfi_flush_enable(false);
52 + enable = false;
53 else
54 return -EINVAL;
55
56 + /* Only do anything if we're changing state */
57 + if (enable != rfi_flush)
58 + rfi_flush_enable(enable);
59 +
60 return 0;
61 }
62