Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6564267iob; Tue, 10 May 2022 23:45:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlshGozcVGz+MTatfcpL1NB+16p9kj16R9C44kkW48NeNQ8AmW8bb7D40j9hiUpCpYakD/ X-Received: by 2002:a05:6402:1e88:b0:428:4782:a16e with SMTP id f8-20020a0564021e8800b004284782a16emr27551021edf.191.1652251552572; Tue, 10 May 2022 23:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652251552; cv=none; d=google.com; s=arc-20160816; b=EyFeeEvYlKvVYabsQjOlxRK3VRkrwi3MmgaO3d+fsSAsqymBpHgFwq67SRJY756vOP hqSKtgv9Xw2BSZjBhlN3BTH6PSvX13o3Rm2kBnwWpu1PAoPfW1Tcd/usDyMej0KPadT4 Ilz+HLzpklRQqH+k465rDhvPqVPT1lQBaQI2mnxJbOBGVJ/hOFMHd8i97H8IVyNGWof0 bUN5h8NbSuXB0OX2Y3cdlqGrxbGibuGYYR9j2RiFmpVkIPuUuIXjIyERf9pooW7lGiL7 25KFZLF6ntLaB4HCQ1FYBHK2V6qdSI1lE92S5s4bPonwwlPxGmg8YAMvntIzoNmwjGKQ OHPQ== 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=a1BgmNZoSyYf9affsN9jX+cEuzAMs9cctYzYl3KtEwE=; b=yHun1z49xshzhPMS81KZ2I7T46goZMYcFh/gPkgPa8fP6YydZ5HAcepVaSSUieAR4r ClU9+pVzOBPS/JmS2vnUbidJMxHNRj4IHuisIfGWlxz+Xbxf6dX/T4gk5Tw8PQdaGhE4 rqcAre3EgsTCezBgXI/V16Epz1PAt5bLzqAJ9zXepQ7re5fmUaMwA3IPcFfcmOUHEdxv ER2IskrLgwW7MgrtzkXW11ek0RMoY7UTuk6N5LhXMB/XJ5hhT84DqNhzY8wqFOREkLWl OyZGyC8aQPtrP8qF3+63Y3eJ6BZLcFYqIuDqIXMYWGH7LDmWiTHhZFQETqnez7jklxeP nvFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZuprcYjg; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e21-20020a17090681d500b006df76385ee7si1317489ejx.903.2022.05.10.23.45.26; Tue, 10 May 2022 23:45:52 -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=@intel.com header.s=Intel header.b=ZuprcYjg; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241316AbiEKCaE (ORCPT + 99 others); Tue, 10 May 2022 22:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241241AbiEKC3o (ORCPT ); Tue, 10 May 2022 22:29:44 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B0721A961 for ; Tue, 10 May 2022 19:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652236180; x=1683772180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zyE/+02x9Fj+FgL1GeYtDyYutpy6orbTRtxDnBCOxV4=; b=ZuprcYjgpYiDGzNC69bPz48Adpdfmq8ghcs8qSKIgwqVBrWjrO3QYxBt M8cF28Wsu7g46Dbdea/KSwqMiKyrpOLIcimGOdilfqMKO4PrRIQR9rmtP aEy7i8HgUFMLb1vqO1l9LteR64N2gP2cW4xl8XES5G2Q+pQlbV2hh3ot8 cXR9mEEHKrl+X0P2McOc94fE7k2miUsp0D+SQBaWgBC9BETBaS5x57Icj P4mEx9TuPGyZJwOKPZzBj6uW5CMOI1CyeMPPKCQpUWZk0lxlEzCuqx2Sw VhdwBpYMOX7psNXG/tnBucXtPSjTSRJxwAm8PovGPU1r4cDaSjvO+mDUX w==; X-IronPort-AV: E=McAfee;i="6400,9594,10343"; a="269497327" X-IronPort-AV: E=Sophos;i="5.91,215,1647327600"; d="scan'208";a="269497327" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 19:29:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,215,1647327600"; d="scan'208";a="542092629" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 10 May 2022 19:29:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 2444753B; Wed, 11 May 2022 05:28:01 +0300 (EEST) From: "Kirill A. Shutemov" To: Dave Hansen , Andy Lutomirski , Peter Zijlstra Cc: x86@kernel.org, Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [RFCv2 02/10] x86: CPUID and CR3/CR4 flags for Linear Address Masking Date: Wed, 11 May 2022 05:27:43 +0300 Message-Id: <20220511022751.65540-4-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220511022751.65540-1-kirill.shutemov@linux.intel.com> References: <20220511022751.65540-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Enumerate Linear Address Masking and provide defines for CR3 and CR4 flags. Signed-off-by: Kirill A. Shutemov --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/uapi/asm/processor-flags.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 73e643ae94b6..d443d1ba231a 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -299,6 +299,7 @@ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */ #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */ +#define X86_FEATURE_LAM (12*32+26) /* Linear Address Masking */ /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h index c47cc7f2feeb..d898432947ff 100644 --- a/arch/x86/include/uapi/asm/processor-flags.h +++ b/arch/x86/include/uapi/asm/processor-flags.h @@ -82,6 +82,10 @@ #define X86_CR3_PCID_BITS 12 #define X86_CR3_PCID_MASK (_AC((1UL << X86_CR3_PCID_BITS) - 1, UL)) +#define X86_CR3_LAM_U57_BIT 61 /* Activate LAM for userspace, 62:57 bits masked */ +#define X86_CR3_LAM_U57 _BITULL(X86_CR3_LAM_U57_BIT) +#define X86_CR3_LAM_U48_BIT 62 /* Activate LAM for userspace, 62:48 bits masked */ +#define X86_CR3_LAM_U48 _BITULL(X86_CR3_LAM_U48_BIT) #define X86_CR3_PCID_NOFLUSH_BIT 63 /* Preserve old PCID */ #define X86_CR3_PCID_NOFLUSH _BITULL(X86_CR3_PCID_NOFLUSH_BIT) @@ -132,6 +136,8 @@ #define X86_CR4_PKE _BITUL(X86_CR4_PKE_BIT) #define X86_CR4_CET_BIT 23 /* enable Control-flow Enforcement Technology */ #define X86_CR4_CET _BITUL(X86_CR4_CET_BIT) +#define X86_CR4_LAM_SUP_BIT 28 /* LAM for supervisor pointers */ +#define X86_CR4_LAM_SUP _BITUL(X86_CR4_LAM_SUP_BIT) /* * x86-64 Task Priority Register, CR8 -- 2.35.1