Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1740775iog; Tue, 14 Jun 2022 12:13:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1upSB+kg4+XuEyzKTA59peZ59q78+kMv9uG5vRBLp2lzUitJgOYPvx7Cu/UipkyTDyCigUb X-Received: by 2002:aa7:d157:0:b0:42d:c3a9:5beb with SMTP id r23-20020aa7d157000000b0042dc3a95bebmr8072688edo.160.1655233985093; Tue, 14 Jun 2022 12:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655233985; cv=none; d=google.com; s=arc-20160816; b=jOmRXhGrWbwpZNcQMvagXJU/wTVVda0YOtynPPoQcKsNrpXlBIDrwZhctGRP0y1Yv2 BhLWrha50x+EEL5XWeE2MyaVhyigt9yh0i1JX92ob8H0n58kB5xlhO0b5oVcxe94nJ2l kHkfmhvHsFFhspp78XUIlglYl28z0CpmfizuXdIwhIyKxSUdcv95nvejSVBHVmrAkGxe kA7ZjMwnMxX9UO7maR9tBh7wUEyh01BgT/g4KlpuKdQiIMR5eo/7Pct+ugi+zEw2NDli GiTzOTGerXj4xSXxTPPqb0cnaNvgG2NxvJMNmymfMpGsCwyZKyFU3M70FoZbpWdtbjBu vVZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O+wBbAf+9+5thJ3GTc8wRlMculA2O7K0/jWLz7u9GkM=; b=KN3lbqJl3FIfLtq/1Iu6y1FenDgcmP4WYm0fuD8DZO46xFwIZkBy2s9SzDXMRA9uFp uv1TwFMA8vf8NJ1J4CzGduzjeMgq1dH/tm6Nvwr1wK+c7VNJFjXlOtjwyDDjTucZnUew ZuNbXKqv35uw0IzNar0SlggO0nN2CDp7w81n9uH4T49RuqUGm1aEJxxMpJCVVqAhEBRO Kp6QDzCAR4zhGVMtAUwrvPALN/CHcXHuctVFqLGQdEZDpYUIuKVGzAgA3raVWaLCLS9M 7ouJVIp0V69objBxBexS9F8Tq7h2GBr311caYnxCR8pCvhxWhM6kOgvBrQWh5QKCh+4L bVVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2brOSHe7; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a17090673c900b006fead2c3278si11837952ejl.192.2022.06.14.12.12.38; Tue, 14 Jun 2022 12:13:05 -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=@linuxfoundation.org header.s=korg header.b=2brOSHe7; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358315AbiFNSwH (ORCPT + 99 others); Tue, 14 Jun 2022 14:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358354AbiFNSvl (ORCPT ); Tue, 14 Jun 2022 14:51:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B3D022295; Tue, 14 Jun 2022 11:45:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3526F617C4; Tue, 14 Jun 2022 18:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 473E3C3411B; Tue, 14 Jun 2022 18:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655232348; bh=4dZ2MEnL8HgaaqOyInfP+Rk/J1TNbvELIOhbpPpmJSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2brOSHe7EhWY06hDoOFxajbkEUKlhrP5FBeFYLzRN5G0NrUedPLdsUY3tCxhrvQRb aEQF/SQPpqKP7E9jSJF3UOJPrbTOE/yZtFvVtoc8RVaXs23dcsTa4kfnPiAFF5B1W9 3377+/R6+RFy1ok8o+m4/CkmivDT7JvTNbYSLTck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pawan Gupta , Borislav Petkov , Thomas Gleixner Subject: [PATCH 5.18 05/11] x86/bugs: Group MDS, TAA & Processor MMIO Stale Data mitigations Date: Tue, 14 Jun 2022 20:40:42 +0200 Message-Id: <20220614183722.204623725@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220614183720.861582392@linuxfoundation.org> References: <20220614183720.861582392@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Pawan Gupta commit e5925fb867290ee924fcf2fe3ca887b792714366 upstream MDS, TAA and Processor MMIO Stale Data mitigations rely on clearing CPU buffers. Moreover, status of these mitigations affects each other. During boot, it is important to maintain the order in which these mitigations are selected. This is especially true for md_clear_update_mitigation() that needs to be called after MDS, TAA and Processor MMIO Stale Data mitigation selection is done. Introduce md_clear_select_mitigation(), and select all these mitigations from there. This reflects relationships between these mitigations and ensures proper ordering. Signed-off-by: Pawan Gupta Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/bugs.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -42,6 +42,7 @@ static void __init ssb_select_mitigation static void __init l1tf_select_mitigation(void); static void __init mds_select_mitigation(void); static void __init md_clear_update_mitigation(void); +static void __init md_clear_select_mitigation(void); static void __init taa_select_mitigation(void); static void __init mmio_select_mitigation(void); static void __init srbds_select_mitigation(void); @@ -122,19 +123,10 @@ void __init check_bugs(void) spectre_v2_select_mitigation(); ssb_select_mitigation(); l1tf_select_mitigation(); - mds_select_mitigation(); - taa_select_mitigation(); - mmio_select_mitigation(); + md_clear_select_mitigation(); srbds_select_mitigation(); l1d_flush_select_mitigation(); - /* - * As MDS, TAA and MMIO Stale Data mitigations are inter-related, update - * and print their mitigation after MDS, TAA and MMIO Stale Data - * mitigation selection is done. - */ - md_clear_update_mitigation(); - arch_smt_update(); #ifdef CONFIG_X86_32 @@ -520,6 +512,20 @@ out: pr_info("MMIO Stale Data: %s\n", mmio_strings[mmio_mitigation]); } +static void __init md_clear_select_mitigation(void) +{ + mds_select_mitigation(); + taa_select_mitigation(); + mmio_select_mitigation(); + + /* + * As MDS, TAA and MMIO Stale Data mitigations are inter-related, update + * and print their mitigation after MDS, TAA and MMIO Stale Data + * mitigation selection is done. + */ + md_clear_update_mitigation(); +} + #undef pr_fmt #define pr_fmt(fmt) "SRBDS: " fmt