From nobody Tue Dec 16 23:59:17 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 217F0EE49AD for ; Fri, 25 Aug 2023 10:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244523AbjHYKUx (ORCPT ); Fri, 25 Aug 2023 06:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244408AbjHYKUK (ORCPT ); Fri, 25 Aug 2023 06:20:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 538211991; Fri, 25 Aug 2023 03:19:51 -0700 (PDT) Date: Fri, 25 Aug 2023 10:19:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692958770; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gs+nfbqvXhUtUiEFQXU91vgz+E370ySbDByaeTGkzmY=; b=oTLUIKViADBO+Pat29pSx84DDdy8XEAVrM0TwF+16wvb202LGS/lZPPt+BtjYFSfrNlUfL QM1z+wUOjKguuXUygAd/vixAFreKqn2+YmO7qeGIHpzh3EXU8vmoyWmSfYrtRSIUvQOrB6 g0QGVnxdcEHSmDUIz1O9gcQDS4knN6T8VVYO2pe7FaiJYvCQK7but5YLc8NNLnIABgyfbr BzV4h/xmHZkDlBlKVSOWjwV0C0veqPBwkg8kc3HYhNlGzWT4YUCDdncXo4yUisrxX94pV0 5y41U1LhLq755AMkzIt+7ycuRVQxknP3DxuM36wiYPCGBBGiyrYqn2YoxrVr3A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692958770; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gs+nfbqvXhUtUiEFQXU91vgz+E370ySbDByaeTGkzmY=; b=ob/eNiKJUGfocCK3kNuBlzh9uK0PwpFFDxKZ0XNMW+zHT5dWbeHhfspbz5Afzxx9iB8aJw lpj1WOKzkrOux/AA== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/bugs] x86/srso: Remove 'pred_cmd' label Cc: Josh Poimboeuf , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <169295877026.27769.9258274335954143778.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/bugs branch of tip: Commit-ID: 2685c96f0cd51e56a1bad4d08d41eddf8f0f5890 Gitweb: https://git.kernel.org/tip/2685c96f0cd51e56a1bad4d08d41eddf8= f0f5890 Author: Josh Poimboeuf AuthorDate: Fri, 25 Aug 2023 00:01:46 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 25 Aug 2023 11:22:00 +02:00 x86/srso: Remove 'pred_cmd' label SBPB is only enabled in two distinct cases: 1) when SRSO has been disabled with srso=3Doff 2) when SRSO has been fixed (in future HW) Simplify the control flow by getting rid of the 'pred_cmd' label and moving the SBPB enablement check to the two corresponding code sites. This makes it more clear when exactly SBPB gets enabled. Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/ec18b04787fc21874303f29746a49847751eddd6.16= 92919072.git.jpoimboe@kernel.org --- arch/x86/kernel/cpu/bugs.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index d883d1c..3c7f634 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -2410,13 +2410,21 @@ static void __init srso_select_mitigation(void) { bool has_microcode =3D boot_cpu_has(X86_FEATURE_IBPB_BRTYPE); =20 - if (!boot_cpu_has_bug(X86_BUG_SRSO) || cpu_mitigations_off()) - goto pred_cmd; + if (cpu_mitigations_off()) + return; + + if (!boot_cpu_has_bug(X86_BUG_SRSO)) { + if (boot_cpu_has(X86_FEATURE_SBPB)) + x86_pred_cmd =3D PRED_CMD_SBPB; + return; + } =20 if (has_microcode) { /* * Zen1/2 with SMT off aren't vulnerable after the right * IBPB microcode has been applied. + * + * Zen1/2 don't have SBPB, no need to try to enable it here. */ if (boot_cpu_data.x86 < 0x19 && !cpu_smt_possible()) { setup_force_cpu_cap(X86_FEATURE_SRSO_NO); @@ -2439,7 +2447,9 @@ static void __init srso_select_mitigation(void) =20 switch (srso_cmd) { case SRSO_CMD_OFF: - goto pred_cmd; + if (boot_cpu_has(X86_FEATURE_SBPB)) + x86_pred_cmd =3D PRED_CMD_SBPB; + return; =20 case SRSO_CMD_MICROCODE: if (has_microcode) { @@ -2501,11 +2511,6 @@ static void __init srso_select_mitigation(void) =20 out: pr_info("%s%s\n", srso_strings[srso_mitigation], has_microcode ? "" : ", = no microcode"); - -pred_cmd: - if ((!boot_cpu_has_bug(X86_BUG_SRSO) || srso_cmd =3D=3D SRSO_CMD_OFF) && - boot_cpu_has(X86_FEATURE_SBPB)) - x86_pred_cmd =3D PRED_CMD_SBPB; } =20 #undef pr_fmt