From patchwork Mon Aug 14 09:37:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 135340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2659532vqi; Mon, 14 Aug 2023 03:57:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUmEByL2W9K3iKgiNGrb0GaXJQtfyIlxmsxIYbaJMYUCIu3XtD4q2Ok7CJC/KAXrfErlDj X-Received: by 2002:a17:906:518a:b0:99d:9ca9:8c19 with SMTP id y10-20020a170906518a00b0099d9ca98c19mr3229384ejk.74.1692010654216; Mon, 14 Aug 2023 03:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692010654; cv=none; d=google.com; s=arc-20160816; b=O05zWs3TWv5crhkC+mpGS4ee9928b+XfYhAAXpsrqY6topx1U/fZASD5kKtZJv2jvY dSq0XbaW1oqsAOILxV1QL4+LpaV2hw4Nk6luKDO8JytGfgSMZ+lU7QMw3mA18iC3mxzR ER+1GJNvsP92pcCSQRsReRwJj8//5q0ADkH45DT/xDh5wZtNUh7Kw8cd2SGe4qQ5ahvO 9Oawu5HdT5urdly8ppjEHrFwuYsqvzMhzwU83ddhPiFFbOUpi4E8Nvcoozq4fOsti/US UC1IRpV7ZliJOn/kS5lQ8upLP59s4QKwbPvlM3w1Pdo4O8iCH75p1c3GgZBcPm5yw8Kq JqVQ== 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=F5gFe4yCE9PlQUdWkfqkyDI/QSw/oTR7ipx5+16LFuk=; fh=9lZb8mpOQUX5k5wmSA9uVO++C8ofId1r53PY60v0Lag=; b=FFtIIYIxyGv5FmCG8IXAj4hCJPEMkGXUXS6SJA+mnEPdEwAA+QdhUZSskVL+5LkFXj GJOfK0S69lJuPxcDfHwZu030hlvtSIYbJ555Kuf64MLsVS5PZN/5h7HwelkXr8vFYCJL wRSXbAXxH6ZmcPDKu27hrcrK4x79jkASvp9H/Es/it9y6zzgegy8DPx7RtARdqWCKC7A DfQ95ftQ+w6BlkVk9kuvz6Jxd153lvSnXBYmxaZL2cKDKFuP/mUHtAkn2Aqrw7IHjEJ+ ZovHaJQMixQwfToFKRzE5ZVIQZA+4LRovZKFPNmBmwIXvv3vO1GvHjLMEBdLaMTND/Xg X8tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SDcqvwM0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/LbkhOR8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o27-20020a17090637db00b0099bd621989asi7795152ejc.405.2023.08.14.03.57.10; Mon, 14 Aug 2023 03:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SDcqvwM0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/LbkhOR8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232756AbjHNJih (ORCPT + 99 others); Mon, 14 Aug 2023 05:38:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235740AbjHNJiD (ORCPT ); Mon, 14 Aug 2023 05:38:03 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05CD119B9; Mon, 14 Aug 2023 02:37:40 -0700 (PDT) Date: Mon, 14 Aug 2023 09:37:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692005858; 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=F5gFe4yCE9PlQUdWkfqkyDI/QSw/oTR7ipx5+16LFuk=; b=SDcqvwM0nJdzuPZwCIYo4Vx53axKtU+eN6M46ftDGJD/15T/g7RxdzzCD1my4GVA1B9yEq V1vBlLC+yRFk5mLX/Z2ll87hjurnliu7HOm+RXFycKtJhfSkUBPOmSzSdTvXkksCXtPJRB HzC3TFSx42iLxlzlhl65hzAQw2TjJLLvPT+o3BMtr0gSLlthqwxucnfyonGt/fiBjpMA+m DPHuB1OK6/ziwthtSYSr1DyT8kNa/krPpVAldZ0dLXMKpJ5b8bxUjJMfwy9g43Sb2g6IFR /ai9SJT8+SrrSk+Az6YmXXCpNxdJBzEICFyyR8Fbn8vVo9Ihmrs+xmq6vJU1CA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692005858; 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=F5gFe4yCE9PlQUdWkfqkyDI/QSw/oTR7ipx5+16LFuk=; b=/LbkhOR8Iwun/rVB9ATlahASQGa4NEiuhXYZrcVwxQytHfb/Iqt7ExT7Hb9ad6uiQc1DCE bhDn5cXsN5Di8GBw== From: "tip-bot2 for Borislav Petkov (AMD)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/srso: Disable the mitigation on unaffected configurations Cc: "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230813104517.3346-1-bp@alien8.de> References: <20230813104517.3346-1-bp@alien8.de> MIME-Version: 1.0 Message-ID: <169200585787.27769.13062428559701196926.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774111570858746756 X-GMAIL-MSGID: 1774201763377860431 The following commit has been merged into the x86/urgent branch of tip: Commit-ID: e9fbc47b818b964ddff5df5b2d5c0f5f32f4a147 Gitweb: https://git.kernel.org/tip/e9fbc47b818b964ddff5df5b2d5c0f5f32f4a147 Author: Borislav Petkov (AMD) AuthorDate: Sun, 13 Aug 2023 12:39:34 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 14 Aug 2023 11:28:51 +02:00 x86/srso: Disable the mitigation on unaffected configurations Skip the srso cmd line parsing which is not needed on Zen1/2 with SMT disabled and with the proper microcode applied (latter should be the case anyway) as those are not affected. Fixes: 5a15d8348881 ("x86/srso: Tie SBPB bit setting to microcode patch detection") Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20230813104517.3346-1-bp@alien8.de --- arch/x86/kernel/cpu/bugs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index d02f73c..6c04aef 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -2418,8 +2418,10 @@ static void __init srso_select_mitigation(void) * IBPB microcode has been applied. */ if ((boot_cpu_data.x86 < 0x19) && - (!cpu_smt_possible() || (cpu_smt_control == CPU_SMT_DISABLED))) + (!cpu_smt_possible() || (cpu_smt_control == CPU_SMT_DISABLED))) { setup_force_cpu_cap(X86_FEATURE_SRSO_NO); + return; + } } if (retbleed_mitigation == RETBLEED_MITIGATION_IBPB) { @@ -2696,6 +2698,9 @@ static ssize_t retbleed_show_state(char *buf) static ssize_t srso_show_state(char *buf) { + if (boot_cpu_has(X86_FEATURE_SRSO_NO)) + return sysfs_emit(buf, "Not affected\n"); + return sysfs_emit(buf, "%s%s\n", srso_strings[srso_mitigation], (cpu_has_ibpb_brtype_microcode() ? "" : ", no microcode"));