Skip to content

Commit bc9c930

Browse files
committed
powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti
Because there may be some performance overhead of the RFI flush, add kernel command line options to disable it. We add a sensibly named 'no_rfi_flush' option, but we also hijack the x86 option 'nopti'. The RFI flush is not the same as KPTI, but if we see 'nopti' we can guess that the user is trying to avoid any overhead of Meltdown mitigations, and it means we don't have to educate every one about a different command line option. Signed-off-by: Michael Ellerman <[email protected]>
1 parent aa8a5e0 commit bc9c930

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

arch/powerpc/kernel/setup_64.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,29 @@ early_initcall(disable_hardlockup_detector);
805805
#ifdef CONFIG_PPC_BOOK3S_64
806806
static enum l1d_flush_type enabled_flush_types;
807807
static void *l1d_flush_fallback_area;
808+
static bool no_rfi_flush;
808809
bool rfi_flush;
809810

811+
static int __init handle_no_rfi_flush(char *p)
812+
{
813+
pr_info("rfi-flush: disabled on command line.");
814+
no_rfi_flush = true;
815+
return 0;
816+
}
817+
early_param("no_rfi_flush", handle_no_rfi_flush);
818+
819+
/*
820+
* The RFI flush is not KPTI, but because users will see doco that says to use
821+
* nopti we hijack that option here to also disable the RFI flush.
822+
*/
823+
static int __init handle_no_pti(char *p)
824+
{
825+
pr_info("rfi-flush: disabling due to 'nopti' on command line.\n");
826+
handle_no_rfi_flush(NULL);
827+
return 0;
828+
}
829+
early_param("nopti", handle_no_pti);
830+
810831
static void do_nothing(void *unused)
811832
{
812833
/*
@@ -877,6 +898,7 @@ void __init setup_rfi_flush(enum l1d_flush_type types, bool enable)
877898

878899
enabled_flush_types = types;
879900

880-
rfi_flush_enable(enable);
901+
if (!no_rfi_flush)
902+
rfi_flush_enable(enable);
881903
}
882904
#endif /* CONFIG_PPC_BOOK3S_64 */

0 commit comments

Comments
 (0)