From patchwork Tue Jul 12 23:13:16 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: 12915795 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 51725C433EF for ; Tue, 12 Jul 2022 23:13:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA2EC9400DB; Tue, 12 Jul 2022 19:13:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D52919400DC; Tue, 12 Jul 2022 19:13:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C423F9400DB; Tue, 12 Jul 2022 19:13:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B5DE7940063 for ; Tue, 12 Jul 2022 19:13:28 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 89F823512A for ; Tue, 12 Jul 2022 23:13:28 +0000 (UTC) X-FDA: 79680001296.07.BD7269F Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf21.hostedemail.com (Postfix) with ESMTP id 657BC1C007B for ; Tue, 12 Jul 2022 23:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657667607; x=1689203607; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eoYteC6GODz7y0R2zobgy/O4IaLSlJbZw9u65ssKePw=; b=CmLPlT6aBb7OJCW82/yDxYqiuxirgYQeP/N7S/M2sxJW0A2lxHdxvG+Q LeqW7DERuFhpQGJJ1Pzpchw7s6ECf1fucNJGcHW0OtmUlrVgMY0iTTk/x RSkHTpGdKk1kIxFcIQJ6L2nXahe9Xr6wKcKUS9Y76NoBlRe9KMW0H6Z9t ccheb2Ow6YkDsJEx+HoXQ/0f7CUj+7XvR9PzdLuevFdU/YO6R189CG+EP XN+mBSlwSO0lO8hVQLJr5ovcFkgBZnULTXM6l64Mke6QrlB4gXYBYw1km 85a73mqeB1Wz+4gGoeoAaQ6PnSzi2PZkSTF76RR1BwZPRi2gaxTAh2nUA g==; X-IronPort-AV: E=McAfee;i="6400,9594,10406"; a="286196154" X-IronPort-AV: E=Sophos;i="5.92,266,1650956400"; d="scan'208";a="286196154" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2022 16:13:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,266,1650956400"; d="scan'208";a="599542507" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 12 Jul 2022 16:13:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id B877BD9; Wed, 13 Jul 2022 02:13:29 +0300 (EEST) 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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv5 01/13] x86/mm: Fix CR3_ADDR_MASK Date: Wed, 13 Jul 2022 02:13:16 +0300 Message-Id: <20220712231328.5294-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220712231328.5294-1-kirill.shutemov@linux.intel.com> References: <20220712231328.5294-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657667608; a=rsa-sha256; cv=none; b=ciNC7fxUh/Ah50BNraYmRIZsjYLzN9foMn8rxlLzi2iKw9pRvXf1/iBv8FAImjtf3/J3Eo bUVgQj3QfuAI/ZwybO9Jh5HeQD1V0+5+koRUSEIf+qeN6jq/m2IinqhKvU6FhveB9YOolj vUIeWJGAv8YUHtkmGkU881rFRzfCrb4= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=CmLPlT6a; spf=none (imf21.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657667608; 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=KuyAZkoFzY4weTeArp06FMvOHcBT/05M8fqMpTHDt6s=; b=Urh3+Mzck6IzLuxUk2I1FMPdxLZaNEZE/U3hfNvay6AhDZ08BSgyEr3nr9bIxKQdjE4Oaf WbDx0o5nrqdsy/g/IkEyNLm1VvGRvz8xPeKmz+Q+qyerkbqsoqrwr1wY64kVqGajU6jnzp Qx9lWeBkMQJz2GmUEKTl4U/BOw2lMuc= X-Rspamd-Queue-Id: 657BC1C007B Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=CmLPlT6a; spf=none (imf21.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam02 X-Rspam-User: X-Stat-Signature: rckr54gj5jk8p8use3hckaw8sjwskrpb X-HE-Tag: 1657667607-780338 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 --- 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)