Received: by 10.213.65.68 with SMTP id h4csp2794315imn; Mon, 2 Apr 2018 14:14:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+dxjbBEct6MtScYbAX6WBq/dhaJeAKoWuREB4p0bWpIt/RCwrL9VZX4daneBgHuIkhN1eW X-Received: by 10.101.96.141 with SMTP id t13mr7382162pgu.222.1522703668460; Mon, 02 Apr 2018 14:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522703668; cv=none; d=google.com; s=arc-20160816; b=F+7qDRRkGUluluiLid+orvUaHWmSKNSfGPxYeJgRmjry3FBi0kuVHsy1aUEwKkQBjO ml7QW/jJ5BqLtKqSvp7H+uotIHI/YOAOqfoPA1aMbEANsXwyBhE7I663iTklmFBP6uZg pGLDe2qIXOlk21xPflqE4jdUhY7KD0Z5VJk8rF/2PlzhZP/0FbBRc7KomO9oTgx8b0Es vRXzeeORjbqyDhaFrtMR6hgaiEOcDS60acbKtyQxVMTQhO6ns8fAcPuxKlRsImx2eFwA dQGdilQw4YHH0QP/pbIaKYsxS4P/gdAz1SLKlLwBSLyKcTJoM8VNr2z1yUFLBQmOblZG 7EEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt :openpgp:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=oiw3KtNl0jhKf86XbdccrgGa45etDSXt41j3P24T+RA=; b=0o+OgEKVGo1DjjyusJtd1saQKbUmdQ35m+hxzHT7jIpi62PyXsaCtgG6XtcmoPkHgt IlCA8dVvmpibtKQYMaB/GAYCmEJL+zMEUkgkRyeeklAdx2bU/pni8wNrNse39Tqi1Bc1 1VRZTe5L1hBgpASSxKDDEC06OlH4EvxXAtADeNtFixHVQzbdeAJBpnViVGPs9Wx38kbZ uWOTtr2ez2S2bKAFJ4Jdi2QFEuEoI+bH8H6RsUxPkaHqxveG6s7bx/SNCVG9XhLwk1Bs DoRsIn6c4cyOXCkCKEn4cHl4xGg3fVSeonx7kOp9GgwBkh3OIlX0JippCW/UCs5GIx/g ARSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=E01h1uBG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si844745pff.122.2018.04.02.14.14.13; Mon, 02 Apr 2018 14:14:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=E01h1uBG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754429AbeDBVMx (ORCPT + 99 others); Mon, 2 Apr 2018 17:12:53 -0400 Received: from mail-by2nam01on0042.outbound.protection.outlook.com ([104.47.34.42]:46637 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753218AbeDBVMv (ORCPT ); Mon, 2 Apr 2018 17:12:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=oiw3KtNl0jhKf86XbdccrgGa45etDSXt41j3P24T+RA=; b=E01h1uBGcn5Ieo65WNIG8OmXRgJtO7zRfgpQb8p/YF7CdAv74mM9Loia4WkvHRIxJcTNvJyXAOGWMreyCiuXnhfCXj5vP4nnYlncHkURw/iD3Q1R75ES8+gMHQ1rSk7t3MnFNje6pmaun2MboSLoaN891Ghlzb4SLL+4vuMq9go= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from [10.236.65.235] (165.204.78.1) by BY2PR12MB0164.namprd12.prod.outlook.com (2a01:111:e400:585a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.10; Mon, 2 Apr 2018 21:12:45 +0000 Subject: Re: [PATCHv2 01/14] x86/mm: Decouple dynamic __PHYSICAL_MASK from AMD SME To: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" Cc: Dave Hansen , Kai Huang , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20180328165540.648-1-kirill.shutemov@linux.intel.com> <20180328165540.648-2-kirill.shutemov@linux.intel.com> From: Tom Lendacky Openpgp: preference=signencrypt Autocrypt: addr=thomas.lendacky@amd.com; keydata= xsFNBFaNZYkBEADxg5OW/ajpUG7zgnUQPsMqWPjeAxtu4YH3lCUjWWcbUgc2qDGAijsLTFv1 kEbaJdblwYs28z3chM7QkfCGMSM29JWR1fSwPH18WyAA84YtxfPD8bfb1Exwo0CRw1RLRScn 6aJhsZJFLKyVeaPO1eequEsFQurRhLyAfgaH9iazmOVZZmxsGiNRJkQv4YnM2rZYi+4vWnxN 1ebHf4S1puN0xzQsULhG3rUyV2uIsqBFtlxZ8/r9MwOJ2mvyTXHzHdJBViOalZAUo7VFt3Fb aNkR5OR65eTL0ViQiRgFfPDBgkFCSlaxZvc7qSOcrhol160bK87qn0SbYLfplwiXZY/b/+ez 0zBtIt+uhZJ38HnOLWdda/8kuLX3qhGL5aNz1AeqcE5TW4D8v9ndYeAXFhQI7kbOhr0ruUpA udREH98EmVJsADuq0RBcIEkojnme4wVDoFt1EG93YOnqMuif76YGEl3iv9tY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OXwEbIt76L1basrRMY7urJm8 4VM6MeG2mfa92FfrMeL0pnD5ONg1FIuleGlvvKdQdFnE4AlwGcKid5GUD+vNNj/pbZyUpe4r zBFsc21/8jXSlR6zJS4mgkNDIIBGiPny3tvKINMZ8VK00mR6INpd+NErd2LxwZ/DQ5ejVyVL 080CbiD55mxxhqkbd5fHSfdhvvXIIYN+nM/RFLwaQGW9g62iFWlqeNRXezkERDV5ahFqZMP4 YDdodn0nRVZYu2kaXfOclKPcH58HlrRb8pKTE3t/TNKGY3SmKoznH0QtM27TWeZ9R9RgTYiV zSNqP+QUNp6BotWI Message-ID: <3513ea99-eb16-6538-ea3b-148fe5d85f21@amd.com> Date: Mon, 2 Apr 2018 16:12:16 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180328165540.648-2-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: MWHPR22CA0062.namprd22.prod.outlook.com (2603:10b6:300:12a::24) To BY2PR12MB0164.namprd12.prod.outlook.com (2a01:111:e400:585a::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b6854790-45d9-45ee-7f79-08d598de7b74 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BY2PR12MB0164; X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0164;3:AFCXsyravSb8rR+1E9swEviSb77sBYA4vetIPWmLcQORjCnYnqJOpP2Q5WN+13z6vpjJ0HmUKCFoqUP6ior9B3B71ttljgFy5/Jdow3SfP/sQqObGdLpEyfu7T2a8GVdHpRrOZG96URzesRi4OBpCPVIcqpAZYM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JdET6MI219qG6FHTOLo8DeSbLi+UopyF6svxop0WzGARJ7Ikm47l0a92+qsEWcm4prJQRLAj5k40qYVqrOrdx8XO6aiDbM+WOC/XWEGij5dFcOt16fTyyxC/44FCLzbIzB61362h/GiDhwyQlJyPzgoIgetbGOTEgCn+UYRBu;4:WBQSVdrVZI0yKN5u/FHmT9SMh41w4JYiSyH/otrfS0/GYUEgxKbb5JIhXfFKwZAV073MYU+UFaIhcyL/uO183GN0RS/BskgS5lC22OS74yGmrbkJmlodPOngOm/Tyim/l1u5zkLw0CIBZojRfrBUpQmCB8eyVq7yOJvJuM0kSb0EvvKvj70prl0K8eIiaQUSIPtddbCcCnUHQ7hg5d68g85vb78uSFCaSxzjiFZnfgPwNE30a65F9cw+8828siNqfVSNXl0nx0yoqfd4VfcdkAqyU1k2TIGvNjagykOyrxJT+OYURQbumBRjE/4n/oQugZzbpUU9tj7Q2fP+u9+sxw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:BY2PR12MB0164;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0164; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(39380400002)(366004)(376002)(396003)(346002)(39860400002)(189003)(199004)(66066001)(31696002)(52146003)(52116002)(305945005)(23676004)(2486003)(53936002)(7736002)(86362001)(58126008)(316002)(110136005)(476003)(486005)(77096007)(11346002)(446003)(386003)(186003)(16526019)(76176011)(68736007)(6246003)(25786009)(59450400001)(6486002)(486005)(4326008)(16576012)(97736004)(65956001)(5660300001)(229853002)(3260700006)(26005)(53546011)(956004)(2616005)(65826007)(47776003)(65806001)(478600001)(31686004)(64126003)(105586002)(36756003)(54906003)(6666003)(6116002)(2906002)(3846002)(230700001)(8936002)(81156014)(72206003)(50466002)(106356001)(8676002)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0164;H:[10.236.65.235];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjEyTUIwMTY0OzIzOi9CM3ZuWGc0MzlUbmZjeGJGN0dnUi81UjFa?= =?utf-8?B?Z0t6cENxU2x3RU04L1htMGJhSW5WWktrcnU4bzZhM25FWlZSNTBYQVdrWUU5?= =?utf-8?B?UElTTzZMSTdGVVIwdEtRdGVsSWZ5VCthWmpDbGJJaFQrL2NyQjNoQzVJd3pZ?= =?utf-8?B?LzRQSkNXMzcrbUF4ekVXMGdDM0MwbngvT0VENituYVhlVy92L3JvUFdSME85?= =?utf-8?B?RjlrOHZHeWRGUGoxY3hrd2lpK3ZNWXNRb1hnSzM5bHBHQmhZTHd5aC9lRU8v?= =?utf-8?B?aUFGS1JqeTVuUUNRTHpKSlpnUFN3Q2x4ZE5HRzA1KzlEUFkza2IxUFNXb0Mw?= =?utf-8?B?bkNWNDUxcUJuS1Zzd2FvU1JSNXVmTHBZSWpXVW93WDc2blB2alA3NHZoM0J1?= =?utf-8?B?d3hrbmxWc0Z2MCtZaDZjQU5sWXFtbW9KZHhWRC9HNWJUVW5MS016VDErRXpy?= =?utf-8?B?dnQzZS9vWCsybXFTemJxSXowNElGRCtnRzlUV2NSa203ZHNHcVZyQ2RIVWVx?= =?utf-8?B?Wk80VlRBY0tBcWtQL095dDFsSHV5YUpPdVVaeVNrMXV2YXdnTkcvTnN4YUIz?= =?utf-8?B?bjdpdHl1dlI5MnJCb2IxY2gycDcxM2RTOWJPdWU4aG8vRE9QNitnS2tqQ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ouqewx/9hj8E10sqDS8ehg3OnYMf8y73pVpMm7NMlID3nkzIQR18xK5oBAuwPEGJEOAXsK6dNg/xfQqsfco3aNZbnVbP5dLGUCGZukqB9q2Cw18tJYlxLRW X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 21:12:45.3739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b6854790-45d9-45ee-7f79-08d598de7b74 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0164 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/28/2018 11:55 AM, Kirill A. Shutemov wrote: > AMD SME claims one bit from physical address to indicate whether the > page is encrypted or not. To achieve that we clear out the bit from > __PHYSICAL_MASK. > > The capability to adjust __PHYSICAL_MASK is required beyond AMD SME. > For instance for upcoming Intel Multi-Key Total Memory Encryption. > > Factor it out into a separate feature with own Kconfig handle. > > It also helps with overhead of AMD SME. It saves more than 3k in .text > on defconfig + AMD_MEM_ENCRYPT: > > add/remove: 3/2 grow/shrink: 5/110 up/down: 189/-3753 (-3564) > > We would need to return to this once we have infrastructure to patch > constants in code. That's good candidate for it. > > Signed-off-by: Kirill A. Shutemov Reviewed-by: Tom Lendacky > --- > arch/x86/Kconfig | 4 ++++ > arch/x86/boot/compressed/kaslr_64.c | 5 +++++ > arch/x86/include/asm/page_types.h | 8 +++++++- > arch/x86/mm/mem_encrypt_identity.c | 3 +++ > arch/x86/mm/pgtable.c | 5 +++++ > 5 files changed, 24 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 27fede438959..bf68138662c8 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -332,6 +332,9 @@ config ARCH_SUPPORTS_UPROBES > config FIX_EARLYCON_MEM > def_bool y > > +config DYNAMIC_PHYSICAL_MASK > + bool > + > config PGTABLE_LEVELS > int > default 5 if X86_5LEVEL > @@ -1503,6 +1506,7 @@ config ARCH_HAS_MEM_ENCRYPT > config AMD_MEM_ENCRYPT > bool "AMD Secure Memory Encryption (SME) support" > depends on X86_64 && CPU_SUP_AMD > + select DYNAMIC_PHYSICAL_MASK > ---help--- > Say yes to enable support for the encryption of system memory. > This requires an AMD processor that supports Secure Memory > diff --git a/arch/x86/boot/compressed/kaslr_64.c b/arch/x86/boot/compressed/kaslr_64.c > index 522d11431433..748456c365f4 100644 > --- a/arch/x86/boot/compressed/kaslr_64.c > +++ b/arch/x86/boot/compressed/kaslr_64.c > @@ -69,6 +69,8 @@ static struct alloc_pgt_data pgt_data; > /* The top level page table entry pointer. */ > static unsigned long top_level_pgt; > > +phys_addr_t physical_mask = (1ULL << __PHYSICAL_MASK_SHIFT) - 1; > + > /* > * Mapping information structure passed to kernel_ident_mapping_init(). > * Due to relocation, pointers must be assigned at run time not build time. > @@ -81,6 +83,9 @@ void initialize_identity_maps(void) > /* If running as an SEV guest, the encryption mask is required. */ > set_sev_encryption_mask(); > > + /* Exclude the encryption mask from __PHYSICAL_MASK */ > + physical_mask &= ~sme_me_mask; > + > /* Init mapping_info with run-time function/buffer pointers. */ > mapping_info.alloc_pgt_page = alloc_pgt_page; > mapping_info.context = &pgt_data; > diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h > index 1e53560a84bb..c85e15010f48 100644 > --- a/arch/x86/include/asm/page_types.h > +++ b/arch/x86/include/asm/page_types.h > @@ -17,7 +17,6 @@ > #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) > #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) > > -#define __PHYSICAL_MASK ((phys_addr_t)(__sme_clr((1ULL << __PHYSICAL_MASK_SHIFT) - 1))) > #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) > > /* Cast *PAGE_MASK to a signed type so that it is sign-extended if > @@ -55,6 +54,13 @@ > > #ifndef __ASSEMBLY__ > > +#ifdef CONFIG_DYNAMIC_PHYSICAL_MASK > +extern phys_addr_t physical_mask; > +#define __PHYSICAL_MASK physical_mask > +#else > +#define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1)) > +#endif > + > extern int devmem_is_allowed(unsigned long pagenr); > > extern unsigned long max_low_pfn_mapped; > diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c > index 1b2197d13832..7ae36868aed2 100644 > --- a/arch/x86/mm/mem_encrypt_identity.c > +++ b/arch/x86/mm/mem_encrypt_identity.c > @@ -527,6 +527,7 @@ void __init sme_enable(struct boot_params *bp) > /* SEV state cannot be controlled by a command line option */ > sme_me_mask = me_mask; > sev_enabled = true; > + physical_mask &= ~sme_me_mask; > return; > } > > @@ -561,4 +562,6 @@ void __init sme_enable(struct boot_params *bp) > sme_me_mask = 0; > else > sme_me_mask = active_by_default ? me_mask : 0; > + > + physical_mask &= ~sme_me_mask; > } > diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c > index 34cda7e0551b..0199b94e6b40 100644 > --- a/arch/x86/mm/pgtable.c > +++ b/arch/x86/mm/pgtable.c > @@ -7,6 +7,11 @@ > #include > #include > > +#ifdef CONFIG_DYNAMIC_PHYSICAL_MASK > +phys_addr_t physical_mask __ro_after_init = (1ULL << __PHYSICAL_MASK_SHIFT) - 1; > +EXPORT_SYMBOL(physical_mask); > +#endif > + > #define PGALLOC_GFP (GFP_KERNEL_ACCOUNT | __GFP_ZERO) > > #ifdef CONFIG_HIGHPTE >