Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1739088iog; Tue, 14 Jun 2022 12:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8CyA36GJMSGwvU6OQl83foFWk8FdEnBaY8h99bUHzeocdjvIyZ4Iz3knywWaqkwsQb25p X-Received: by 2002:a05:6a00:1acd:b0:51c:795b:860c with SMTP id f13-20020a056a001acd00b0051c795b860cmr6261170pfv.16.1655233838312; Tue, 14 Jun 2022 12:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655233838; cv=none; d=google.com; s=arc-20160816; b=PIlZXW9FAXFJ1IITetOxFhngE/LhokFdeyPgKZVlbKarVtNaFvVMR8Gk7M0m/Le1xO ul45MsQKJjjxcgMbSzA6qS7guewXKS6HSEV2jGr/n+wj90zvkgDEVYt+VyPhrg52dof4 s+CJjvva/jpB5S5BuHDh5QSasUrHJoe8P0sUlS8RUlru4lORXJ7+bER3vVOa7cgfw2is v4akw8DA/B/lxNG2SHTg+4xaOlltH0vVxDOHA+jH2MXXbbvkJiMaAVCtB/ir4el0H8QE +8bMf1s0+waMNHP2FLpc6aUWo5hcacRfgVhQ7k6qESmEG7ljm1f6gYhPkji7BL+CQao0 u6qw== 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=67egBkiOJXgyNY5rioJK2ttLtEWzyiPkjiwR+LYEpl4=; b=h+dg9oAS63m6Df8zyobZKo2C1xUWeAoGQyoG+wV5uZauVmneKpGzgAPK2qawWIJKeN ++TScdDGN5ZdpLRZ+s1NWF3fOqZItVeh1jdwhxfy5zOD+vgzvREral+/f1PawmtViV5k ryoETrCakMdj9vvi4HiGf5ik/DYruUxcHyfILZ8i+4aeLrGqp7iPBvRB12dO2qnNjPoC 5+HJ5tMW4YQQ1gELEBIVVAZjiWQ81G/ronGtSMzw7NAnliPBa0ddI4LyPmRjqSFucsWb gudoykBq06vfQV0d4Y1Pv5kh7CZfaH9BGFymOe9fu8FSJNiDjPh0ya6vxX4B5F+eAehC kcdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wJkVawcH; 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 d12-20020a056a0010cc00b005228c3285f6si6625867pfu.168.2022.06.14.12.10.24; Tue, 14 Jun 2022 12:10:38 -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=wJkVawcH; 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 S1357242AbiFNStR (ORCPT + 99 others); Tue, 14 Jun 2022 14:49:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357904AbiFNSs1 (ORCPT ); Tue, 14 Jun 2022 14:48:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87C0B4CD55; Tue, 14 Jun 2022 11:44:43 -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 BF85A617E6; Tue, 14 Jun 2022 18:44:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB1C7C3411D; Tue, 14 Jun 2022 18:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655232282; bh=8d4dWYQZs/Nmwj3C9/Iu1D1Ku840lk/6/4bf2emlNLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wJkVawcH6Vr7fslAVnRVqwyltmYcIrjyPzCrJeg2O35OcxD2+59nnG3sp/hIpo6Mq jgGGuDiXtfCC3j6nWTb8AgXLJdMvvYN+YhRuDeqyFf8flFIUGYdf2Cq2O4jDCaSKnB F7KAcQLRcsFtCwHsuWc6GSGEDNtmEQBDHMa2T/Lw= 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.10 05/11] x86/bugs: Group MDS, TAA & Processor MMIO Stale Data mitigations Date: Tue, 14 Jun 2022 20:40:27 +0200 Message-Id: <20220614183721.238692983@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220614183719.878453780@linuxfoundation.org> References: <20220614183719.878453780@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); @@ -114,18 +115,9 @@ 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(); - /* - * 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 @@ -511,6 +503,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