Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1924990rdb; Wed, 31 Jan 2024 13:27:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvltswiOXi5DFVTOkk4VSlXmOlfNn7YPNxKoc4LQv7mx6SO1GaVjDP2Tq6ejf6NRemY15R X-Received: by 2002:a05:6358:3a0a:b0:176:d3d2:66a2 with SMTP id g10-20020a0563583a0a00b00176d3d266a2mr2689051rwe.15.1706736460751; Wed, 31 Jan 2024 13:27:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706736460; cv=pass; d=google.com; s=arc-20160816; b=Ji3DYW2IrV7P1LtJ6xpM1YNGC6HvnITJmaAz5SeKQcWdoIDpdpNOIPpoyuaJ089rNA yRjGFY5BCi2rgmb1BWOMpSFv4BGgwPxplt2QmDaFAviwmlzOiRuqcz7SRC9/Tx2zOGAK MoIqTy6r6qLSwQmJR7fqy7X5E13bubFEc66AwMbFoYxTO2Q0+SIQuugoBPCLSWkuZb6E UtcTbSi4BiEL1q35vIanU7leKaUk9E1u7qwo/FZzgn3hsLGz2MZXMp12PfroYEY3ARKO szFNG5fj2i/E9ujyeDPGdWORBVFrtjX0uFLgoCMvmY0vU1tOYCgp+9KzmOX5XxM/SyMc 4sqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=bHzAREIZjBCQhX7gFd+k7R9tMdKXx+CAWHyaGIDAJJM=; fh=ZrcBcrN5znY3s3BK81xYikcbVLe+1yQLZ5gxcgfh6ew=; b=XafjVp3z0TXudpf8bqc+rPo8qW5Gvvt0NP4db4y9omwnkdXrzJUjv1vYY4Jsa8G810 UX4kPG68fLLAedWdmYNXa6v6Exu4MbWk77ARNWnTV5adfDYgwMAF4MIArf6yOpTbxJZR sn2jgAkuqmwzCO48F0xkVrih/54aWJm/8eh61u7IMza4eBP8nWbmNJ/hu7RdXr7Y3xcQ 8RGUE6rwNOULGlMEPb7dy9qnoaKX1FqVQd79U2ZOl2Q5xbXzWbJxrdjRdu2ITGCJKGi9 IOTzW3seT6jqJ1FHnlAq2Z2OQ+Q5uowGcebTmQVSiH4GztcOLQgOvDAYXcYQMISWVfsR rRBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=p2m+uUDY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-47140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCUCDy+IvVWVYMbauTK+RA3+0dsfWxUZAJGmpNRB0HhOO6YAiGXnbKOz86w2NH/wmS5bjy4HbQ8+dyTEKdZucJ7ILmCL3mWtSo2O5EwBig== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z23-20020a63e557000000b005d9252c9cf5si4105101pgj.62.2024.01.31.13.27.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 13:27:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=p2m+uUDY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-47140-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 30AAAB26A3F for ; Wed, 31 Jan 2024 21:20:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFA1245BFC; Wed, 31 Jan 2024 21:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="p2m+uUDY"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="T+RiLubm" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1A0E3FB06; Wed, 31 Jan 2024 21:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706735697; cv=none; b=nhy7gLWkkN+abbY2kCNpOyqbAKh54cGdS5houYZ4j/lb2J0/WAcVR3QhdnA3gqAONuwAhEkdq0NL8G9gHZRGRfHthSR4vDzP0ScL5w9hxScPEyYZCTeY4A5ucsZhBSYZLP4GGEEcwr4siGSG+Yi/78zjhKI9CeSZJPybgg60SZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706735697; c=relaxed/simple; bh=pV2zr4++IAVGn1UyLL0YQuC3DbVc1LjBvwuFyR3Lg2Q=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=jDImA0enh6+6z+6toXKHAkt1NFTALRhh/biGHd1q0504JSBYPgd23ExVK72tVVCKMLKPgHLjMWka8dttTIbp+mPxC0K0xI7XRE3Rz2HSBgvWe4gTZxHiSlyl4pv+jeVg2mQ5k9aCvPe2GkkxDOj2cfQ1796PrsIX17ulA++GanE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=p2m+uUDY; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=T+RiLubm; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 31 Jan 2024 21:14:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706735694; 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=bHzAREIZjBCQhX7gFd+k7R9tMdKXx+CAWHyaGIDAJJM=; b=p2m+uUDYX1i8MJuByAmEpn2OYCucVW3Tj87NOn+Ri3TSleBiwjbiJ08xL36YgnJ2CbgDWN jBseLLFlx/v1SWeiAmXeYa01ygDrNhb1s19bzpGh6BFs9NZRCCpLW7O2tw72IR9gBa6L+4 qk4k97poNp+/W6dL9BWf9FbnlWmQmPoyjzlFH4fy8QDOBsE5380lsV7Iikv7nIoukQ3jDI tbD5VleXnUqKRiPhhFYlru3WC4xi52NuBkZzMArrQp387Bgimt2/TR5/kOekabnSDqjYTH HQ83vdZpVZEPOwJui6yfizP+aNehdrZyeaD6eBLT5/riSTvh9A3D5i3m/Yl9YA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706735694; 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=bHzAREIZjBCQhX7gFd+k7R9tMdKXx+CAWHyaGIDAJJM=; b=T+RiLubmjeObsoa7tojTgDEEvyKb4eyQBIKHXN3vLaypkrI+uIlvbsKuhHKJBL4VPmzkeS ado/tnwNGw+BqcDg== From: "tip-bot2 for H. Peter Anvin (Intel)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fred] x86/cpu: Add X86_CR4_FRED macro Cc: "H. Peter Anvin (Intel)" , Xin Li , Thomas Gleixner , "Borislav Petkov (AMD)" , Shan Kang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231205105030.8698-12-xin3.li@intel.com> References: <20231205105030.8698-12-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170673569353.398.15524385501761288714.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/fred branch of tip: Commit-ID: ff45746fbf005f96e42bea466698e3fdbf926013 Gitweb: https://git.kernel.org/tip/ff45746fbf005f96e42bea466698e3fdbf926013 Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:50:00 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 31 Jan 2024 22:00:38 +01:00 x86/cpu: Add X86_CR4_FRED macro Add X86_CR4_FRED macro for the FRED bit in %cr4. This bit must not be changed after initialization, so add it to the pinned CR4 bits. Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov (AMD) Tested-by: Shan Kang Link: https://lore.kernel.org/r/20231205105030.8698-12-xin3.li@intel.com --- arch/x86/include/uapi/asm/processor-flags.h | 7 +++++++ arch/x86/kernel/cpu/common.c | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h index d898432..f1a4adc 100644 --- a/arch/x86/include/uapi/asm/processor-flags.h +++ b/arch/x86/include/uapi/asm/processor-flags.h @@ -139,6 +139,13 @@ #define X86_CR4_LAM_SUP_BIT 28 /* LAM for supervisor pointers */ #define X86_CR4_LAM_SUP _BITUL(X86_CR4_LAM_SUP_BIT) +#ifdef __x86_64__ +#define X86_CR4_FRED_BIT 32 /* enable FRED kernel entry */ +#define X86_CR4_FRED _BITUL(X86_CR4_FRED_BIT) +#else +#define X86_CR4_FRED (0) +#endif + /* * x86-64 Task Priority Register, CR8 */ diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 0b97bcd..c3a1757 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -382,9 +382,8 @@ out: } /* These bits should not change their value after CPU init is finished. */ -static const unsigned long cr4_pinned_mask = - X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP | - X86_CR4_FSGSBASE | X86_CR4_CET; +static const unsigned long cr4_pinned_mask = X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP | + X86_CR4_FSGSBASE | X86_CR4_CET | X86_CR4_FRED; static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); static unsigned long cr4_pinned_bits __ro_after_init;