Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp547768imi; Thu, 21 Jul 2022 06:27:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1toKNzsvpyZwFo+kNvOkqvQ0v3YCE+s8JacHUbn7ODaLPIx/edrJ4h9g9G/VOwh5VkmHqHf X-Received: by 2002:a05:6808:6d7:b0:325:67ff:a21b with SMTP id m23-20020a05680806d700b0032567ffa21bmr4786948oih.105.1658410040132; Thu, 21 Jul 2022 06:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658410040; cv=none; d=google.com; s=arc-20160816; b=neKjlCzMWJnRDR7supo/+dmSMEzkfzw2x3sfROnPvXgrmdsi8cR0xmeSSRBESpziP/ zswKkgTWNqdynG/bey7OeheNqOPIakZCxg57vSpuDrr+z0uLp8j2xRc88bMrb66rzuyd zvXEqpaOPXjDBseSWqX4mmSpC4xyQ/6gK3GUpXrLnyKhM9kSL1eou2rCX5WaRO8VgPpX xFhBC5ui7unKzTsRLAux4/ld647rFgZjq9hxz6N1C8WtACSsp0qaAOR2wUMYxiqdB6Ik CVre0qvMSZYSIjJXpbYh1J5/NHVISvsBKF7q+lvlfKZWsKkCMFdi8ltxsoZ16wqPur85 35+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3KJW7Fmbq5f+eNMw6VzguHX0B49FKPw4A5l5sLUXhGo=; b=kCLK2jr9vp69SCw9We7YRdcksGdIQR/j+sKWJ5Gjjgsk9bJ8Z856lC9a5sgQypgqqh 2QR2j6zD2zdAmui7Xy4bY3YGtyEsBwdOuP5vl8z+n8EuEqOZLqJQwNAL9oz3RzcFleui eZ6INCyW2l/GTWQSrDT623JKzGBi+UFAaXtXBHXBfB0nqvYW44wjXZyUEzaszBtUY7In UlINC1t1U24LmdsfWxarcR7Scu3svOv4lhePFxDvsZXRQECC2ym6cJgj2qVGq92ZkG6E 8W6hGgBTK2O+X26ymfky15elJ9dCX2kipTjizzGTFpjNPq8bhcmVjoZBNLXtTUPBzsp3 t+bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=cDDJz93v; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n23-20020a056870559700b0010c1a449cefsi1625861oao.311.2022.07.21.06.27.05; Thu, 21 Jul 2022 06:27:20 -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=@google.com header.s=20210112 header.b=cDDJz93v; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234024AbiGUNLh (ORCPT + 99 others); Thu, 21 Jul 2022 09:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233842AbiGUNLe (ORCPT ); Thu, 21 Jul 2022 09:11:34 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 767E02B607 for ; Thu, 21 Jul 2022 06:11:24 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-2ef5380669cso16459697b3.9 for ; Thu, 21 Jul 2022 06:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3KJW7Fmbq5f+eNMw6VzguHX0B49FKPw4A5l5sLUXhGo=; b=cDDJz93vgcNNLNytxqCbx8V77gcnQB+j09ztN3Q/A3wfSuguHHr5vSGyiDed9ADcd6 Qu8RozwM8yO7TnX8u91/tggfA68L2JN2YkymYnnjqHMkjhSx+8Y73kM+UE8/hiVaa1Xv N9gvNrjJro7Zs83exyXlClnG1UGLhSE5k5vtiC7qEjl6+nITPm1PvNpvnOsAvO7FTTOP o7HkYit2MdLNBhbVQ6J99MG+RyRcpRVTLE2ecIuE5B2p82n95kJOVCFpALnohXFpZdXQ MR+CqTl70MXZZUY30UZxA8llahXQgVjFk0T38Xz+7+cfOil+jfutmR3l7AVmBo5f+Ktk RK5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3KJW7Fmbq5f+eNMw6VzguHX0B49FKPw4A5l5sLUXhGo=; b=ehWRkCklsNL0nI/ba0Nsp15SHjJW5LbZVaxu7UF7Ll8zNY2BtKshlYkBZ0DnmATUDi N2HGzDDuXuRGw0Vju3lBMYvi/0b0G6GjaRMltTESSpZeY5z1+OAXyfSKn/uB/PiUj7oB UkrInOEGcuuvfxFoX0NtXDrk3bKptaOJrdG2P6N35qnEFEDQuyPd4OaRgKYGUbGB8f7e EZSdyZtMyyXj/gRMQfzqBrUqMiZCynTF2Evjq/sID+xNjvtxuuOSIB+X+mNfInqOB7Hn IBIMzOSFdunkAT2uNROTyGgde0zuHTJr+QTUj8qq8dD5vwJ/H6VPKwVPaXyYUp+tC5Tt Svhg== X-Gm-Message-State: AJIora+Vtri/VIIosGjJbfeFcEFhe9cHhBYdRsd/lIzqRkYnq9XwI+uI 2y4EJPDq9SgfC9W7xTLofHiAYYe2+Js6ILGrrA04ig== X-Received: by 2002:a81:a1ca:0:b0:31e:58d4:e724 with SMTP id y193-20020a81a1ca000000b0031e58d4e724mr15075845ywg.486.1658409083510; Thu, 21 Jul 2022 06:11:23 -0700 (PDT) MIME-Version: 1.0 References: <20220712231328.5294-1-kirill.shutemov@linux.intel.com> <20220712231328.5294-3-kirill.shutemov@linux.intel.com> In-Reply-To: <20220712231328.5294-3-kirill.shutemov@linux.intel.com> From: Alexander Potapenko Date: Thu, 21 Jul 2022 15:10:47 +0200 Message-ID: Subject: Re: [PATCHv5 02/13] x86: CPUID and CR3/CR4 flags for Linear Address Masking To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , "the arch/x86 maintainers" , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Wed, Jul 13, 2022 at 1:13 AM Kirill A. Shutemov wrote: > > Enumerate Linear Address Masking and provide defines for CR3 and CR4 > flags. > > Signed-off-by: Kirill A. Shutemov Reviewed-by: Alexander Potapenko Tested-by: Alexander Potapenko > --- > 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/cp= ufeatures.h > index 03acc823838a..6ad5841e087f 100644 > --- a/arch/x86/include/asm/cpufeatures.h > +++ b/arch/x86/include/asm/cpufeatures.h > @@ -300,6 +300,7 @@ > /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 *= / > #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructio= ns */ > #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLO= AT16 instructions */ > +#define X86_FEATURE_LAM (12*32+26) /* Linear Addr= ess 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/inclu= de/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 b= its 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 b= its 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 Enforce= ment 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 > --=20 Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg