Skip to content

Commit 1e2a9fc

Browse files
committed
powerpc/rfi-flush: Move the logic to avoid a redo into the debugfs code
rfi_flush_enable() includes a check to see if we're already enabled (or disabled), and in that case does nothing. But that means calling setup_rfi_flush() a 2nd time doesn't actually work, which is a bit confusing. Move that check into the debugfs code, where it really belongs. Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Mauricio Faria de Oliveira <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent ac96588 commit 1e2a9fc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

arch/powerpc/kernel/setup_64.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,6 @@ static void do_nothing(void *unused)
846846

847847
void rfi_flush_enable(bool enable)
848848
{
849-
if (rfi_flush == enable)
850-
return;
851-
852849
if (enable) {
853850
do_rfi_flush_fixups(enabled_flush_types);
854851
on_each_cpu(do_nothing, NULL, 1);
@@ -902,13 +899,19 @@ void __init setup_rfi_flush(enum l1d_flush_type types, bool enable)
902899
#ifdef CONFIG_DEBUG_FS
903900
static int rfi_flush_set(void *data, u64 val)
904901
{
902+
bool enable;
903+
905904
if (val == 1)
906-
rfi_flush_enable(true);
905+
enable = true;
907906
else if (val == 0)
908-
rfi_flush_enable(false);
907+
enable = false;
909908
else
910909
return -EINVAL;
911910

911+
/* Only do anything if we're changing state */
912+
if (enable != rfi_flush)
913+
rfi_flush_enable(enable);
914+
912915
return 0;
913916
}
914917

0 commit comments

Comments
 (0)