From patchwork Thu Oct 19 18:11:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 155681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp580484vqb; Thu, 19 Oct 2023 11:38:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+IIHDtsm4Epedl9dfic0yxPCmcgv2/SI9t88dTG7EaiYQXpyRZjHn/c52vk+VOD6IpjU1 X-Received: by 2002:a17:90a:fa0c:b0:27d:65:53e1 with SMTP id cm12-20020a17090afa0c00b0027d006553e1mr2887669pjb.16.1697740680796; Thu, 19 Oct 2023 11:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697740680; cv=none; d=google.com; s=arc-20160816; b=VpBw+JweLr5kcXxCBUOa1HTgpZ6D+7WIFkH1wk4ER4H0jkt/QZ2V7Eu610s2G2YYoq gTpOFnYK8hwFiOBRgoxJukvo6nj8QX6dSWrKaaDHeSnTheOVjOwgi1unpHiirR4jJK4k PJUVsHXpPwF1u9B/r2xajNL509cDOdFmuBZSDP7xBZtZF1lY8b04v1ZX1vkxNzwxyNto Vxr3IsvRT8PcpllQljKe06x7QoJLHbsfgIEWidvG7d77fhxOxBPJWJLT38U+rkBX50nI 1vktnV/und0uIW+lnjYsvbHFgK7qTtkEy9VM75MoBicVXy4zhJI1CdXY2sC9BlG70b9P xpWQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Tdae9eZ6qccJdF0xGoTmxbAj070PFYdjsCv8qfK3SD8=; fh=Th/ruqa19Swal8/rnoX+yAvJLXC4cSPPXECct69hW6A=; b=yO//ryiFjzpTC8BD4Q5NHShSgbS3vXnl08KGTzKI/EWC8wPTEkxWKmJIJinj4nDYXj JmqGDeqsIIjXbaTnBKBZrCAVJ6mo7Sx0Df65u5uT8Wl4PjzjMVAdPFKZWN3x48MuZGkh r5ZC7huNQ9K7kAJRIafH1cp6HqDsDyk2a/pHxOZxZiO9ysj/dJcEtZFjdUiccJjiWPIb /jei1qHrCc9FMJggW07RiY/yL6D2ZYgmKxccNRwnpK/LiEI+7KuRdXF7V1ZeDgLzfQSX 0OC+jzlEB61PTlMIIkD/X2H0NDqlBS3U6zRufzPToroybgYGMktvkJFL6Lggkf9SvGjI r5CA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id gp19-20020a17090adf1300b0027d0db5c235si2700426pjb.166.2023.10.19.11.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 11:38:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CB63581B5AB3; Thu, 19 Oct 2023 11:37:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346458AbjJSShe (ORCPT + 26 others); Thu, 19 Oct 2023 14:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235524AbjJSSh2 (ORCPT ); Thu, 19 Oct 2023 14:37:28 -0400 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53A0FBE for ; Thu, 19 Oct 2023 11:37:23 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5046bf37ec1so10484176e87.1 for ; Thu, 19 Oct 2023 11:37:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697740641; x=1698345441; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tdae9eZ6qccJdF0xGoTmxbAj070PFYdjsCv8qfK3SD8=; b=t0npU7F9K78ZJQ8rVQu08M3XW0WkAYXpSeKN8yCuURmvj6oecg3d6DVHSQjKoF8UHu Wn5TqevRL9vhR6wMI3ydB+1XgBgrw7JQZJhxKXoW6eBw82fRVAc7+w559MuGEc+teU/O BfMHXHQ26HyJA8UbcitB5W81cZroP+OmVhz3eKHbff6133SprSkmEm77WofvZ6d3v5XN ke7lErT5Q3dMsI11hPT+DIBnH2/lQuW+hQo4SkA23rBAUszyYG7aq8Hgcxwh/0v+Fod7 mOXpujxDb8HUO9zlDfbyKvzkDUL9btUQ+JGF3SQuuB8CPtAutlU9y2qg/2iR2ywGwkoD V+6g== X-Gm-Message-State: AOJu0Yx2zUVz8aQ5nMeDWPzfwOJGPTy/o+d5N/T0fddWIQLKf41AOsxE O8uvCeklb4wC3oEiOpr7vCY= X-Received: by 2002:a05:6512:479:b0:503:1bb0:a658 with SMTP id x25-20020a056512047900b005031bb0a658mr1938796lfd.32.1697740640921; Thu, 19 Oct 2023 11:37:20 -0700 (PDT) Received: from localhost (fwdproxy-cln-011.fbsv.net. [2a03:2880:31ff:b::face:b00c]) by smtp.gmail.com with ESMTPSA id bx14-20020a0564020b4e00b0052ff9bae873sm66588edb.5.2023.10.19.11.37.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 11:37:20 -0700 (PDT) From: Breno Leitao To: jpoimboe@kernel.org, mingo@redhat.com, tglx@linutronix.de, bp@alien8.de, Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Pawan Gupta Cc: leit@meta.com, linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH v5 08/12] x86/bugs: Rename CPU_IBRS_ENTRY to MITIGATION_IBRS_ENTRY Date: Thu, 19 Oct 2023 11:11:54 -0700 Message-Id: <20231019181158.1982205-9-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019181158.1982205-1-leitao@debian.org> References: <20231019181158.1982205-1-leitao@debian.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 11:37:56 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780210132467727757 X-GMAIL-MSGID: 1780210132467727757 CPU mitigations config entries are inconsistent, and names are hard to related. There are concrete benefits for both users and developers of having all the mitigation config options living in the same config namespace. The mitigation options should have consistency and start with MITIGATION. Rename the Kconfig entry from CPU_IBRS_ENTRY to MITIGATION_IBRS_ENTRY. Suggested-by: Josh Poimboeuf Signed-off-by: Breno Leitao --- arch/x86/Kconfig | 2 +- arch/x86/entry/calling.h | 4 ++-- arch/x86/kernel/cpu/bugs.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0e4c0c5c4818..c53d2034a5ab 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2540,7 +2540,7 @@ config MITIGATION_IBPB_ENTRY help Compile the kernel with support for the retbleed=ibpb mitigation. -config CPU_IBRS_ENTRY +config MITIGATION_IBRS_ENTRY bool "Enable IBRS on kernel entry" depends on CPU_SUP_INTEL && X86_64 default y diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index ace89d5c1ddd..2afdff42c107 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -297,7 +297,7 @@ For 32-bit we have the following conventions - kernel is built with * Assumes x86_spec_ctrl_{base,current} to have SPEC_CTRL_IBRS set. */ .macro IBRS_ENTER save_reg -#ifdef CONFIG_CPU_IBRS_ENTRY +#ifdef CONFIG_MITIGATION_IBRS_ENTRY ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_KERNEL_IBRS movl $MSR_IA32_SPEC_CTRL, %ecx @@ -326,7 +326,7 @@ For 32-bit we have the following conventions - kernel is built with * regs. Must be called after the last RET. */ .macro IBRS_EXIT save_reg -#ifdef CONFIG_CPU_IBRS_ENTRY +#ifdef CONFIG_MITIGATION_IBRS_ENTRY ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_KERNEL_IBRS movl $MSR_IA32_SPEC_CTRL, %ecx diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 2580368c32d1..e11bacbd8f39 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1439,7 +1439,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void) return SPECTRE_V2_CMD_AUTO; } - if (cmd == SPECTRE_V2_CMD_IBRS && !IS_ENABLED(CONFIG_CPU_IBRS_ENTRY)) { + if (cmd == SPECTRE_V2_CMD_IBRS && !IS_ENABLED(CONFIG_MITIGATION_IBRS_ENTRY)) { pr_err("%s selected but not compiled in. Switching to AUTO select\n", mitigation_options[i].option); return SPECTRE_V2_CMD_AUTO; @@ -1565,7 +1565,7 @@ static void __init spectre_v2_select_mitigation(void) break; } - if (IS_ENABLED(CONFIG_CPU_IBRS_ENTRY) && + if (IS_ENABLED(CONFIG_MITIGATION_IBRS_ENTRY) && boot_cpu_has_bug(X86_BUG_RETBLEED) && retbleed_cmd != RETBLEED_CMD_OFF && retbleed_cmd != RETBLEED_CMD_STUFF &&