Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp883879rdb; Tue, 19 Sep 2023 13:07:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT1Bl2TfGaUb9rojguDQsHZgTGIfb0qn3wnjX/r1GfpMAFeolLRWVm1aW+PrBHlEEp0JGA X-Received: by 2002:a05:6a00:2d08:b0:690:ce36:8b00 with SMTP id fa8-20020a056a002d0800b00690ce368b00mr783477pfb.2.1695154035140; Tue, 19 Sep 2023 13:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695154035; cv=none; d=google.com; s=arc-20160816; b=xfwazsP3qyqGy/y+JY9fG3glm28uIvEzQFMmX9j6eLqbS40s6H7ih2Hpx9LcM90P2c Et5dA0ErozaXQvbU0fjn99RF62IZy9YjNqGpkK/mJYmfG9ddWT5DNTiazSsdUFXg43gv NtYviE1GQtMn5yk1wwesOCldRa9NbeuayODn2u4RwHCAo0CD5YLRETzjY3/WSzByxoUw WEi1sBn2nfqr8evw5ZzxhZyQfB+R8vAR8GQZiiVs4DjEaIwHEwlIvZKQ2pcb8rOLnESH n81nRvTupQu/z1CjwrewzLIYJJX2dHAg0qsMUVk3T8ZiWkNddP/o/z3ygCB0Cazv+DZU z8vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=mVfg5UpLxIR+jphwdBhW1SXcgM5G0tlpgt5Dqbu3w1U=; fh=TJa98jjcJcAUyvo2yQiOqi+wukdLlQU80th5XskGe8U=; b=fB4QuSo3Vq2HBj+HB1pbCYT+GRptGuJayGe946HA7rLq9RTxzUSTOGM7GuHlWhgzJS TAvbek9IXuVDW7gTtnagrjW2msz3TVBifR8EYjzzF/UGyLKNvQYgCiyHKCN0QNFqELn3 0KH8vuYAZgFEExEflty5WBEhWge6jpYcpeMD4QDCndxtfLUGq0/g2+6owWCfSMMm/0Xv wpigu6bF2vJaw1jsjEmEp3JkXKDvgj+21jIkeXY5WYzHTR4W9JxNzguHG6eUiYxvyAiU 9XBQZqxR/9KORwOJOj2/eFn4evNa2BqKxojxHsc1/jzeXootFioGJsfttNU/afLxsrxv j19Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mQocmXbR; dkim=neutral (no key) header.i=@linutronix.de header.b="nY/tFznz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id cd8-20020a056a00420800b00690bd178205si2154166pfb.215.2023.09.19.13.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 13:07:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mQocmXbR; dkim=neutral (no key) header.i=@linutronix.de header.b="nY/tFznz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2EA7C8028FEA; Tue, 19 Sep 2023 02:54:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231926AbjISJx6 (ORCPT + 99 others); Tue, 19 Sep 2023 05:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbjISJxV (ORCPT ); Tue, 19 Sep 2023 05:53:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C4DCCD; Tue, 19 Sep 2023 02:53:14 -0700 (PDT) Date: Tue, 19 Sep 2023 09:53:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695117192; 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=mVfg5UpLxIR+jphwdBhW1SXcgM5G0tlpgt5Dqbu3w1U=; b=mQocmXbR1AjtTRvMwtNYM7eWaW8Beq6Y2ZkYg5BQLxcengiIlvKD99e8PRwl1yo7Sjy1gb 2RcP47JhKXfWQ7LkOdUzJRVj+F+7XFIUDlCE6ovOI/lQqquiiPfulvmj/mv/Lxkng/aGNT FqR/ZuwHRIJ9WFKaJVmwqgqdLUOcXgnvPmCgzAgpynZkaZAahUW/cCiHM3fZ2dNvviZmRr sbKqPKS6uGqAxewh6zFXH0T8QuJ/3w1oDLfe8YlG92PAemVR/u/qQwhGMmpj+uVggRgNXv X1HOo3u4IR4nkMZ2psnBn5LQnsJdDAFFEF/EhaTG4P/PdIxCJEkP7nIFwaPrYg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695117192; 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=mVfg5UpLxIR+jphwdBhW1SXcgM5G0tlpgt5Dqbu3w1U=; b=nY/tFznzOd6SbLVi0KXGWD9yWZLmjX4sAsyw3Gbs4bYDLeoqNkPswhBnMTa/ZKn+C5JnxE tNtyc2cXUUZuUtCw== 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 , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <169511719158.27769.3337585251495698419.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: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 19 Sep 2023 02:54:07 -0700 (PDT) The following commit has been merged into the x86/bugs branch of tip: Commit-ID: 73163764dd8d117f2ffa14c0bc816bf1bf8a0e27 Gitweb: https://git.kernel.org/tip/73163764dd8d117f2ffa14c0bc816bf1bf8a0e27 Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:04:57 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 19 Sep 2023 11:42:47 +02:00 x86/srso: Remove 'pred_cmd' label SBPB is only enabled in two distinct cases: 1) when SRSO has been disabled with srso=off 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 Acked-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/bb20e8569cfa144def5e6f25e610804bc4974de2.1693889988.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 e45dd69..4f1ad23 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 = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE); - 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 = PRED_CMD_SBPB; + return; + } 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) switch (srso_cmd) { case SRSO_CMD_OFF: - goto pred_cmd; + if (boot_cpu_has(X86_FEATURE_SBPB)) + x86_pred_cmd = PRED_CMD_SBPB; + return; case SRSO_CMD_MICROCODE: if (has_microcode) { @@ -2501,11 +2511,6 @@ static void __init srso_select_mitigation(void) out: pr_info("%s\n", srso_strings[srso_mitigation]); - -pred_cmd: - if ((!boot_cpu_has_bug(X86_BUG_SRSO) || srso_cmd == SRSO_CMD_OFF) && - boot_cpu_has(X86_FEATURE_SBPB)) - x86_pred_cmd = PRED_CMD_SBPB; } #undef pr_fmt