Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1750088iog; Tue, 14 Jun 2022 12:26:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxvwlNKDql7JvCqCec6dwJ04IpJ+fkE0V024PoqMP4hp63UE+Sf7k0+Gy7psUE3fTLd8U1 X-Received: by 2002:a05:6a00:319b:b0:51b:c5ec:62ba with SMTP id bj27-20020a056a00319b00b0051bc5ec62bamr6056080pfb.1.1655234763587; Tue, 14 Jun 2022 12:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655234763; cv=none; d=google.com; s=arc-20160816; b=vXbXI6AItMEUUIiliPPiVsw1XeKRW64lKo2tFywk6uy4qKsbaKZfPx6ZzEp7qrQ7On z7OmFw2dD68qh2PaXWQIWmXiysrt2sc3JiLVaqO7+uubTmG4KJHKsc/XMC1S/xFg/WDW c/ePxlWMZpXOODNH4z0BiyJUKeD0nk1OG9EhTvCKbBsNAclS1dgtgrtag40rSpeRnSav +lymA/DDwPT+SNi4WALWzRce0K9Oe+dZhryN/efZWwq0BPk2VToMX3TetwJvQChgFMb+ XFuAquHQzWi8/eIEI6JVAo+pR7uPEkcZdsr+TgiSYg+e4U34cgOB+3f+w/ev4OUQxo1d vioQ== 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=pBoek6Pbs3wz/K4Q42BvEsURJ4BAkiGAU+/dGFc9b1YDp9cwrFyxqOjwEB3wjtc7Kt Hj2vm73TZGS5gbUribuWqUkCc6I9ie11bekO0GGyq5jetn3kQpYeCJ5i5zjg19h3LVWb uYo3oRQIX8CK3IoMmhP1+zkdbix2h3KHsvLhYGQ32ZxkWCK+UYvED33hhT+W4seI38bW FHLIkSG/sM3EWEJC+2ReCg3tG2CGV2T8j5kbg9l4o3Sj2tJUGNOx9c5/3VHCJ+vOsKGU 548T/q/CoIBMnlw2LSfajtYZRdQ8x4JriNCz795p7pOcXP725hofkzEYiV7H95XY160v DPjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RlKHO5xV; 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 y16-20020a17090322d000b00163cdf1a201si14802404plg.265.2022.06.14.12.25.51; Tue, 14 Jun 2022 12:26:03 -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=RlKHO5xV; 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 S1358182AbiFNSuR (ORCPT + 99 others); Tue, 14 Jun 2022 14:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357912AbiFNStN (ORCPT ); Tue, 14 Jun 2022 14:49:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58D3D4EA05; Tue, 14 Jun 2022 11:45:18 -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 ams.source.kernel.org (Postfix) with ESMTPS id D1949B8186A; Tue, 14 Jun 2022 18:45:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ED1EC3411E; Tue, 14 Jun 2022 18:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655232315; bh=4dZ2MEnL8HgaaqOyInfP+Rk/J1TNbvELIOhbpPpmJSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RlKHO5xV3PCXSP8mqR+KHD+WuKZ/3BXCBFkM3sqzP6oStMLTS+SCzCQeRtdxIifoO S88txZbefCK5pddwH5+2pnaUDw9Yi8Ww8mbN6UkykooJ4S0rbrOO+trKVNmLHzZ85D VqYw/RGLbIpRA6Q/PLz7gb4Ovmth4ZaVDasHxbfE= 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.15 05/11] x86/bugs: Group MDS, TAA & Processor MMIO Stale Data mitigations Date: Tue, 14 Jun 2022 20:40:34 +0200 Message-Id: <20220614183721.798479670@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220614183720.512073672@linuxfoundation.org> References: <20220614183720.512073672@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