From patchwork Wed Nov 9 16:51:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 13037751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 093E3C43217 for ; Wed, 9 Nov 2022 16:52:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29E2F6B0072; Wed, 9 Nov 2022 11:52:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 24E196B0073; Wed, 9 Nov 2022 11:52:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 116B36B0074; Wed, 9 Nov 2022 11:52:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 02D406B0072 for ; Wed, 9 Nov 2022 11:52:13 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C2079405F1 for ; Wed, 9 Nov 2022 16:52:12 +0000 (UTC) X-FDA: 80114496504.17.BD0EF60 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf01.hostedemail.com (Postfix) with ESMTP id 4D9D94000B for ; Wed, 9 Nov 2022 16:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668012729; x=1699548729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YRI2YivWJDaeR3A5b46DIJCCsip9GmvTxTmH9XsxWxQ=; b=b7kRAJt7xX41X19qNCuSwioLfzUFoQXI1PHbOKHBJ5g3VNjtH2RvP3Nb 5AZJMPu1rf0ZL5CWmymsWSp2DR8h1cD5BcoIqEZXuGrAwbWqIZ02LoxiM dNI+e8bt/28E+70fBbSeCl9V0Aq99EdVa7WBR7EH22fvKOX/Ab3t+gj6X 0r2jYQeZlOiUdg8N0YA2eaxCnpJ59721rY40Ev9vZsvBSGYpD+esd6xJj dBE39Z4pw4Hv51D6tE2wZCg1LOc4/BWXt2Hqp7tGdfCXO758bXp4xh7ej 55qkAet70S39BiVeqxThPP4SqlKKdz47drIA2tuQtbRyaxumWqvLkQo6Y Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="312192097" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="312192097" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 08:52:07 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="700426422" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="700426422" Received: from dschramm-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.219.85]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 08:52:03 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 6269610946C; Wed, 9 Nov 2022 19:52:00 +0300 (+03) From: "Kirill A. Shutemov" To: Dave Hansen , Andy Lutomirski , Peter Zijlstra Cc: x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Bharata B Rao , Jacob Pan , Ashok Raj , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv12 01/16] x86/mm: Fix CR3_ADDR_MASK Date: Wed, 9 Nov 2022 19:51:25 +0300 Message-Id: <20221109165140.9137-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221109165140.9137-1-kirill.shutemov@linux.intel.com> References: <20221109165140.9137-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668012729; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/gQxZVfxZ0XVnQZf+76lcdkLcCWBm7/MmNe6nzWlntI=; b=o3hOxzgc1JDo4DRE+C7OsHPuZPYGuWrgKbclm+a/oBLmo9Liz7mMRnxYdkAKP53Wpb773J 9/HkwNL0Gq/rqmwawpd+wv5doYW3vqmk3IZxEzB/Ss8+2Gm7qoErHiCccpaJgGSVs9X34h +Vdvluyq54+oaUTINuEw9PV/DMslKUo= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=b7kRAJt7; spf=none (imf01.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668012729; a=rsa-sha256; cv=none; b=aVG9IoSX3PbK9GsCH2RufeueOWspvvaeucFQIp/Q+ekvHRs6xncQj9lAiws8H0XzK5QBV6 v8ddq228IhuKEQyqGehH7PZPdkDxJOb3b3nT5t9Z79+x5EAchWy0kg3drmH1Wra4ssPfuZ i21XEtvC8b1Dut+Q17beQswLX6vMZ50= X-Rspam-User: X-Stat-Signature: somprsi8p9kuqazu33y5sxhcqpy39yoh X-Rspamd-Queue-Id: 4D9D94000B Authentication-Results: imf01.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=b7kRAJt7; spf=none (imf01.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none) X-Rspamd-Server: rspam02 X-HE-Tag: 1668012729-154695 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The mask must not include bits above physical address mask. These bits are reserved and can be used for other things. Bits 61 and 62 are used for Linear Address Masking. Signed-off-by: Kirill A. Shutemov Reviewed-by: Rick Edgecombe Reviewed-by: Alexander Potapenko Tested-by: Alexander Potapenko Acked-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/processor-flags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/processor-flags.h b/arch/x86/include/asm/processor-flags.h index 02c2cbda4a74..a7f3d9100adb 100644 --- a/arch/x86/include/asm/processor-flags.h +++ b/arch/x86/include/asm/processor-flags.h @@ -35,7 +35,7 @@ */ #ifdef CONFIG_X86_64 /* Mask off the address space ID and SME encryption bits. */ -#define CR3_ADDR_MASK __sme_clr(0x7FFFFFFFFFFFF000ull) +#define CR3_ADDR_MASK __sme_clr(PHYSICAL_PAGE_MASK) #define CR3_PCID_MASK 0xFFFull #define CR3_NOFLUSH BIT_ULL(63)