From patchwork Tue Oct 18 11:33:44 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: 13010289 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 55F95C4332F for ; Tue, 18 Oct 2022 11:34:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E92B96B0072; Tue, 18 Oct 2022 07:34:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E43186B0075; Tue, 18 Oct 2022 07:34:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0AB06B0078; Tue, 18 Oct 2022 07:34:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BDC916B0072 for ; Tue, 18 Oct 2022 07:34:14 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 54F57120F7D for ; Tue, 18 Oct 2022 11:34:14 +0000 (UTC) X-FDA: 80033861628.25.58213A5 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf27.hostedemail.com (Postfix) with ESMTP id 7053940024 for ; Tue, 18 Oct 2022 11:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666092852; x=1697628852; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YRI2YivWJDaeR3A5b46DIJCCsip9GmvTxTmH9XsxWxQ=; b=ehX9ZGuyW88Egmb3QBbqhQq9X/eSBM8vRaR7xsosFzhFTPZO9X4i5uFy EHM9BL9koBnGqYbumwIEU/mhWQ5x/jWYs5If4uX99iOsLxlKNUmBuJ4jT nIpXZW7n84vbk139oJ2oOMY3LtdJgu/To7cbzAbjrJUFJb348Tu5HSX3h LLg5I5u1cI+ZFGEiLhKSaB8J4/OWjNjnTB6K0N8/8r/Oy8ZzF/HhB+KU3 +T0ETjjuLlZI6kzyEuxlnjlGARYz/bQDe60TRNQ4pIogL3DOLIagZ/p9t eUGnIS5rhhKswF32rKXeSaVbBoGffxTcjLLSadiLZEIhUi3R2QcaxD9H1 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="303690461" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="303690461" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 04:34:11 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="661861119" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="661861119" Received: from vhavel-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.51.115]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 04:34:06 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id EDF1F1046BE; Tue, 18 Oct 2022 14:34:03 +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: [PATCHv10 01/15] x86/mm: Fix CR3_ADDR_MASK Date: Tue, 18 Oct 2022 14:33:44 +0300 Message-Id: <20221018113358.7833-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221018113358.7833-1-kirill.shutemov@linux.intel.com> References: <20221018113358.7833-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ehX9ZGuy; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none); spf=none (imf27.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.93) smtp.mailfrom=kirill.shutemov@linux.intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666092853; a=rsa-sha256; cv=none; b=Y5mBffKUtngTPtRFCyAbiE8FO5RX5Mi3QsZXHDJVZ3XquXoLCVrvD0Ca5xrk2K9HyrK+tY G3zR5AIpxHmFxalMxwGOil6DsMhVBuLq6cOo5Qh7ArG+fzsYmgtZrSdjsQzqnYBEsYba+C xokYeq+IWyylNe7wV1jgaD/4tFbyPGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666092853; 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=OqCVqSAf5a7iH/oGyJgBZc0fk1kgG+RF5ugVXw6U5iIjfwp506N2cyUy7TyvSQdX/sMcYa OaaMBSQTqSns9dmdLIzRT8ieXPF0uBl8deymzeoN90/+3a/L7dO8iaCid4IfdWXDLXpRLI 78C54wkSubBBaeI62R+95Ww6CALgFmg= Authentication-Results: imf27.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ehX9ZGuy; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none); spf=none (imf27.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.93) smtp.mailfrom=kirill.shutemov@linux.intel.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: 7x51a4btg3grrkwz1rpwsum9nwnjofs1 X-Rspamd-Queue-Id: 7053940024 X-HE-Tag: 1666092852-446804 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)