Message ID | 20231205105030.8698-12-xin3.li@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3359424vqy; Tue, 5 Dec 2023 03:23:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfCRtgDPoghCdvVuYJb6JX4QiHlpb5XMZnJEYB5NY2qmtc+CuLt9Tp+1mNHtxlxy4lH0dM X-Received: by 2002:a05:6a20:3948:b0:18c:41cd:c77f with SMTP id r8-20020a056a20394800b0018c41cdc77fmr6006894pzg.45.1701775393431; Tue, 05 Dec 2023 03:23:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701775393; cv=none; d=google.com; s=arc-20160816; b=U6Ozl5pEYRsycIvsJikT2rqHm3hg4Av99t24CH/w4JXdEF+hqWh5c0VYFk6kuAT+bG cAVqVCATtxhGyaraS36wsxYSTgXQ9AjI4TWYGBirpcUxoozcUpNjkP1QrE9E4pz7dlPk Q3hxWEMlg6SC6YHi/immjnl9jAhXV4TmNCjkDiPcF6qOYJ5HfDQiLs9cWrTAzHLnF28/ DeHufrdJEOXN46Wq3hkHGUt74m92VCL1gfyaoinpB1OEy5s28GVfCl6C8VOuSjaO5HvO 55cVHDkCFUSTzdye2PCNZqhbSBwSXCzezfUUcpF8Eom59PyhEzOabeZ1Gsp2ac+f7RiQ 5XwA== 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 :dkim-signature; bh=4hdOtqUCCKKGrlE6y8cyZItHpXpz1UeTLz2Ox4S7tso=; fh=uCCWEUVpLc/xDP/D3WvGY/BxHU9d0NQYu/T71GEsNmA=; b=uiDpWGst1Wu6ZHbEJUYrnTAGjngdr6HXowvFfqlyCSsHaT1EkKJOexp77sVY9tPRci hwEJcq8lHdj6D9oqsWUKJVjgVur4XbtMw9aoiseNf1gOE11Mm8lzRUoF7QPQKWHj3RS+ UHKl8qTzZxeCLrjl4TgPJAP4S9bl6EeEWcg7lo3Tmrt/QU1cSQAdGxS8aBPn5dJ58ouZ TfyxuF6e0oQO/B8TQhaATtOJt3OcJTK7lcPfKZAKi/92rFEg8IjP6JerjgVov7vXYW0q KyjRxEqf0AkiwI6AHjnfG2G+ANrwg1qZHPicKebPL67g8c2kTfeoAco0xnFHIzct9bb/ 0ylg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zkyjk2Qh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id q14-20020a65684e000000b005c67a42a55fsi4407274pgt.732.2023.12.05.03.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 03:23:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zkyjk2Qh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E1FDB822778C; Tue, 5 Dec 2023 03:23:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442193AbjLELVv (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Tue, 5 Dec 2023 06:21:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442075AbjLELVU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 5 Dec 2023 06:21:20 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D0B136; Tue, 5 Dec 2023 03:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701775286; x=1733311286; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ednaCMmFl3XJWL+gfBq22HioBkuQBmZA1PVTbNrlGWM=; b=Zkyjk2Qh3C1j5MtjdpZlauv5fW2BZWqKW+awQMxAZwgbcjDs4YZEaDgu /If7C/vd/aRimMTkxfsvoDjAGfN4RJNHSL8QEC8oHZAuRURIgKQlVA4jq 2pCepSxTtKJjokeOyMNwCcxU1p+UKz/COu8VLJpkZQ1pnCal7bJDmFzPW GcCpZ2lY2OkZ2ZXaFuL6W3kj46DecXlS+mAtdyH2DX/7iVb5azW0La6ax 0fA07Ki3q5utQfs6AEucBHjBS2p0wlIe21HOsv+xKovVaTSigpCEXrZkB tKxEXhqwClBVMXAHLGfOUl8vFSHTBJPbkc4GkByEoXh5T1ExHJzQc2/JA A==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="942445" X-IronPort-AV: E=Sophos;i="6.04,252,1695711600"; d="scan'208";a="942445" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 03:21:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="1018192936" X-IronPort-AV: E=Sophos;i="6.04,252,1695711600"; d="scan'208";a="1018192936" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmsmga006.fm.intel.com with ESMTP; 05 Dec 2023 03:21:19 -0800 From: Xin Li <xin3.li@intel.com> To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-hyperv@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, pbonzini@redhat.com, seanjc@google.com, peterz@infradead.org, jgross@suse.com, ravi.v.shankar@intel.com, mhiramat@kernel.org, andrew.cooper3@citrix.com, jiangshanlai@gmail.com, nik.borisov@suse.com, shan.kang@intel.com Subject: [PATCH v13 11/35] x86/cpu: Add X86_CR4_FRED macro Date: Tue, 5 Dec 2023 02:50:00 -0800 Message-ID: <20231205105030.8698-12-xin3.li@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231205105030.8698-1-xin3.li@intel.com> References: <20231205105030.8698-1-xin3.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 05 Dec 2023 03:23:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784440835177456283 X-GMAIL-MSGID: 1784440835177456283 |
Series |
x86: enable FRED for x86-64
|
|
Commit Message
Li, Xin3
Dec. 5, 2023, 10:50 a.m. UTC
From: "H. Peter Anvin (Intel)" <hpa@zytor.com> 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) <hpa@zytor.com> Tested-by: Shan Kang <shan.kang@intel.com> Signed-off-by: Xin Li <xin3.li@intel.com> --- Changes since v9: * Avoid a type cast by defining X86_CR4_FRED as 0 on 32-bit (Thomas Gleixner). --- 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 d898432947ff..f1a4adc78272 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 68102acd63b0..132f41f7c27f 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -389,9 +389,8 @@ static __always_inline void setup_umip(struct cpuinfo_x86 *c) } /* 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;