From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227VTrjmoJhYzyT5AmANcuPGgzfZ0/JbLDrRFRv1xgHCd+1maoL6bV94Up64OLRIP+dy5Amc ARC-Seal: i=1; a=rsa-sha256; t=1516611035; cv=none; d=google.com; s=arc-20160816; b=VIJXtBJ0wjA6oHJ7/i1dujAqXAljiYc0RCd7XPqP+tYL804G6U3PtNKMWdDoRwpK5y Sj5j/nDCBqS7NebE2dfwIZ7aw1Lo66f9CfrmQvt3S/Kn/xYkmvjbDIdwFqG9AvO3xP4u sKevt+038PV/MoBJtd04allf6bh39xFnzELWcPY56eGAmDb7dPd7Ep6HLuFc1RlYyS1l h5RLGk/4u1Z+UnuZF6yIGRRT1SzbXF6uc26WaDjRgTLvuVf6M29KRa5l53egWkPLerhe XRLInIBN4IY3qFYRNR2qi1d0jMIpdWFM1vWFAM1xe+M/X/Vnotia9iphVHdUJb8idkUo QEGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=KklTxPe+34Q8zU1WG+nhujXtEZ8hF+CacSuvUQ5NPlM=; b=VNAqPai4shaBUwOFoPSWKMsFO+uicTgtJtCRDnrLVTCTN5Qkqe6l0jqJGRSAH7AGTC JlUEzyudk3eHhOTo0uyupufK7iO9G5Xfm8InVECu3GRaE6aRaWNhAVXGzYqqrkRhK1iH 0qe3PVSvMnQvjCwrHO5cyVXVTmxeeIexVFOwg4AgCHRxwAvnH9O5YtwNWOrDaguKyelk FPkIEYP4KHbjeqWBq4cCxpoqh/lKUREXdV+TvAUJ1gRp11RKoVS/Qbh5Rih2/tkdoReF HllT1Fn83iib8G6mHSYCnH2pGzv9qVk1XAluVyw46oO04DC2utMfrYEObjmZSUot75+7 ATgA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman Subject: [PATCH 4.14 13/89] powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti Date: Mon, 22 Jan 2018 09:44:53 +0100 Message-Id: <20180122083956.007677661@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083954.683903493@linuxfoundation.org> References: <20180122083954.683903493@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590281933610922635?= X-GMAIL-MSGID: =?utf-8?q?1590281933610922635?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman commit bc9c9304a45480797e13a8e1df96ffcf44fb62fe upstream. 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 Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/setup_64.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -788,8 +788,29 @@ early_initcall(disable_hardlockup_detect #ifdef CONFIG_PPC_BOOK3S_64 static enum l1d_flush_type enabled_flush_types; static void *l1d_flush_fallback_area; +static bool no_rfi_flush; bool rfi_flush; +static int __init handle_no_rfi_flush(char *p) +{ + pr_info("rfi-flush: disabled on command line."); + no_rfi_flush = true; + return 0; +} +early_param("no_rfi_flush", handle_no_rfi_flush); + +/* + * The RFI flush is not KPTI, but because users will see doco that says to use + * nopti we hijack that option here to also disable the RFI flush. + */ +static int __init handle_no_pti(char *p) +{ + pr_info("rfi-flush: disabling due to 'nopti' on command line.\n"); + handle_no_rfi_flush(NULL); + return 0; +} +early_param("nopti", handle_no_pti); + static void do_nothing(void *unused) { /* @@ -860,6 +881,7 @@ void __init setup_rfi_flush(enum l1d_flu enabled_flush_types = types; - rfi_flush_enable(enable); + if (!no_rfi_flush) + rfi_flush_enable(enable); } #endif /* CONFIG_PPC_BOOK3S_64 */