Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754029AbeAJT1I (ORCPT + 1 other); Wed, 10 Jan 2018 14:27:08 -0500 Received: from mail-bn3nam01on0071.outbound.protection.outlook.com ([104.47.33.71]:52896 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753634AbeAJT0W (ORCPT ); Wed, 10 Jan 2018 14:26:22 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; From: Tom Lendacky Subject: [PATCH v3 3/5] x86/mm: Centralize PMD flags in sme_encrypt_kernel() To: x86@kernel.org Cc: Brijesh Singh , linux-kernel@vger.kernel.org, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Thomas Gleixner Date: Wed, 10 Jan 2018 13:26:16 -0600 Message-ID: <20180110192615.6026.14767.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20180110192544.6026.17285.stgit@tlendack-t1.amdoffice.net> References: <20180110192544.6026.17285.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR1101CA0013.namprd11.prod.outlook.com (10.174.246.23) To BN6PR12MB1138.namprd12.prod.outlook.com (10.168.226.140) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc3751c6-9c0d-45f8-ed61-08d558600773 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7153060)(7193020);SRVR:BN6PR12MB1138; X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1138;3:NG8oYT1kAKs4rsRTqdhMeeuo1ynRYAl8z6OjRq42CWzxgP+Dsj0oFv06F8HYZ9UIfG9U8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JANncurvTPo1DB/YVRRVGU5Ttt6eSYahVQZGwDpoI03hRhRzyqnaXxqld86P6XpOMiYyLRyrDJQCWvZaaVAXR5RJmO9sHz0y5Y/7JyvrsnzfSoLsuWCKfhAwUKDgCbpZEwHOX5aggzPYoElOO2P0fCRr2uky6eNDjlB8rzye+F0zS1fsObZpzAZqiOiLFqh5dlWBEnWwo7WqF0TbsKTqjx7/slD4vKn1LyGwGg5viHxhTriZwCKMk5LbcGp9sxitqHyeTfU1ABv2WmQJWQsb;4:UJDViajwgfeqqaG7YM39FJbR22OXfYuOaO9yfWRr+MjMif0md96BCIAUpTs+TDzBro4QukOL9s8/QWrSp6ka4nGivmsIHyvYwZCniMjE88NcMa5kLKNC/IUtB73DOvCYuMnaehl0IDSe8QP1F9SDLCWyumIxgdf9Bfe+Q1kbAwp5SSz+U5+7lhAE/K2FEfPg+F5brJSjtfo1Zitg1HTx0InpN3G6MYpo/qzoWpDGBF5cHgSRAf+p4gSVyH7DYmqAvHhaU5wfvV8TS1m8jCD+S7LOuPoBRAFYTMj7IqZKKbc8dLtSFwVZEZWVcPGmMcyQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:BN6PR12MB1138;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:BN6PR12MB1138; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(346002)(396003)(376002)(39380400002)(199004)(189003)(5660300001)(72206003)(25786009)(53416004)(103116003)(86362001)(97746001)(478600001)(6666003)(16526018)(54906003)(6916009)(2950100002)(2906002)(7736002)(316002)(8936002)(58126008)(50466002)(81166006)(8676002)(81156014)(97736004)(53936002)(386003)(305945005)(105586002)(4326008)(106356001)(7696005)(2351001)(2361001)(52116002)(76176011)(6506007)(1076002)(23676004)(2486003)(47776003)(66066001)(55016002)(69596002)(68736007)(3846002)(83506002)(6116002)(230700001)(9686003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR12MB1138;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMTM4OzIzOjZQdnZtMjVrbmJtSDFtcittbndiNlFja1VC?= =?utf-8?B?LzhsOGQvelRuZmNCOUlyNFNrSVRIM2tUSVQxZGp1TnRWUXNRa3k0Tnh0WWdq?= =?utf-8?B?Z25jR3ZFZ0JBcVIvaDFrSkYyUWF2T3VBakFIMm5pcVdQdFpJc1JNVDZOYkxQ?= =?utf-8?B?a3QrZ1NieGw4T2hNMk1HbWZKMFVhWWFROE92MkxVVXFsZldjWGNGMHh3b2Rx?= =?utf-8?B?OEZZUTZhWThqN3NDS0p6S0pOOGtCOTFZMXVDTmx3eUhjTTlHc2d6UGorbkVL?= =?utf-8?B?ZFE2Wkp2blRmSWI5eEg2S1ZtelA2bk1CUnVheUhyNlFrS284UG5udnNMUGl1?= =?utf-8?B?SXk5VktzWTAvT1hjY2NueE9mYSt4UTJURTU3NDNvOXg3WGtnbjEyOTFaK0hX?= =?utf-8?B?VGNOZDhTZUEvNWtLYmFnOWxmRUVINklKVmFEdjAvWGpzOWE3dTFQaDdyUFpT?= =?utf-8?B?STlBbE1oL2Z3UUhCK2FlKzZZUCtJUnczTGs2RGplZkZqNEhxd25MWWRmaTJx?= =?utf-8?B?VjZ6NEtuRWFoTVdwZXRCSk05czZ4NnRZeFNlNDZFVWtrVjJtczNiV3Fza2Iw?= =?utf-8?B?SW0zY051WVpIWUt3Sms0WTNmZVBMbG9Fb3Jva01pQVBTanRJM043enZR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PrAUhp3YaPZv/TNn8n7UAwtXc7Ahm+tb/84IhDuTfjVFRxsgTnAbKYSNtPCN3cH/p0zmeXukD3xl1eTe7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1138;20:jp4bCpK8ZRdwZeQqANFWPurS/aNszjaD62YPs50uATXLgWPpm8LoiIgJlLiQF9MZE4eUTXfGztwbBG38OxJ/0yccz3RAgpTCYWZAVd/XHA9oY5KNL29ClEwuKWs6bWHQMx+WaWaKxisUM0p+jVx2dvfkBSxeyK1wz7TwwLlihk1/UBqhhQAgZnpurq1EygVPr6Udag8g8ZFgw9aNlzKS0qW0O9oNXZpJEFu3MBpZAalfk40m5QbTj7KCYGOv25yy X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 19:26:20.1373 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc3751c6-9c0d-45f8-ed61-08d558600773 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1138 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: In preparation for encrypting more than just the kernel during early boot processing, centralize the use of the PMD flag settings based on the type of mapping desired. When 4KB aligned encryption is added, this will allow either PTE flags or large page PMD flags to be used without requiring the caller to adjust. Signed-off-by: Tom Lendacky --- arch/x86/mm/mem_encrypt.c | 133 ++++++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 56 deletions(-) diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 5a20696..35f38ca 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -468,31 +468,39 @@ struct sme_populate_pgd_data { void *pgtable_area; pgd_t *pgd; - pmdval_t pmd_val; + pmdval_t pmd_flags; + unsigned long paddr; + unsigned long vaddr; + unsigned long vaddr_end; }; -static void __init sme_clear_pgd(pgd_t *pgd_base, unsigned long start, - unsigned long end) +static void __init sme_clear_pgd(struct sme_populate_pgd_data *ppd) { unsigned long pgd_start, pgd_end, pgd_size; pgd_t *pgd_p; - pgd_start = start & PGDIR_MASK; - pgd_end = end & PGDIR_MASK; + pgd_start = ppd->vaddr & PGDIR_MASK; + pgd_end = ppd->vaddr_end & PGDIR_MASK; - pgd_size = (((pgd_end - pgd_start) / PGDIR_SIZE) + 1); - pgd_size *= sizeof(pgd_t); + pgd_size = (((pgd_end - pgd_start) / PGDIR_SIZE) + 1) * sizeof(pgd_t); - pgd_p = pgd_base + pgd_index(start); + pgd_p = ppd->pgd + pgd_index(ppd->vaddr); memset(pgd_p, 0, pgd_size); } -#define PGD_FLAGS _KERNPG_TABLE_NOENC -#define P4D_FLAGS _KERNPG_TABLE_NOENC -#define PUD_FLAGS _KERNPG_TABLE_NOENC -#define PMD_FLAGS (__PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL) +#define PGD_FLAGS _KERNPG_TABLE_NOENC +#define P4D_FLAGS _KERNPG_TABLE_NOENC +#define PUD_FLAGS _KERNPG_TABLE_NOENC + +#define PMD_FLAGS_LARGE (__PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL) + +#define PMD_FLAGS_DEC PMD_FLAGS_LARGE +#define PMD_FLAGS_DEC_WP ((PMD_FLAGS_DEC & ~_PAGE_CACHE_MASK) | \ + (_PAGE_PAT | _PAGE_PWT)) + +#define PMD_FLAGS_ENC (PMD_FLAGS_LARGE | _PAGE_ENC) static void __init sme_populate_pgd_large(struct sme_populate_pgd_data *ppd) { @@ -561,7 +569,35 @@ static void __init sme_populate_pgd_large(struct sme_populate_pgd_data *ppd) pmd_p += pmd_index(ppd->vaddr); if (!native_pmd_val(*pmd_p) || !(native_pmd_val(*pmd_p) & _PAGE_PSE)) - native_set_pmd(pmd_p, native_make_pmd(ppd->pmd_val)); + native_set_pmd(pmd_p, native_make_pmd(ppd->paddr | ppd->pmd_flags)); +} + +static void __init __sme_map_range(struct sme_populate_pgd_data *ppd, + pmdval_t pmd_flags) +{ + ppd->pmd_flags = pmd_flags; + + while (ppd->vaddr < ppd->vaddr_end) { + sme_populate_pgd_large(ppd); + + ppd->vaddr += PMD_PAGE_SIZE; + ppd->paddr += PMD_PAGE_SIZE; + } +} + +static void __init sme_map_range_encrypted(struct sme_populate_pgd_data *ppd) +{ + __sme_map_range(ppd, PMD_FLAGS_ENC); +} + +static void __init sme_map_range_decrypted(struct sme_populate_pgd_data *ppd) +{ + __sme_map_range(ppd, PMD_FLAGS_DEC); +} + +static void __init sme_map_range_decrypted_wp(struct sme_populate_pgd_data *ppd) +{ + __sme_map_range(ppd, PMD_FLAGS_DEC_WP); } static unsigned long __init sme_pgtable_calc(unsigned long len) @@ -621,7 +657,6 @@ void __init sme_encrypt_kernel(void) unsigned long kernel_start, kernel_end, kernel_len; struct sme_populate_pgd_data ppd; unsigned long pgtable_area_len; - unsigned long paddr, pmd_flags; unsigned long decrypted_base; if (!sme_active()) @@ -693,14 +728,10 @@ void __init sme_encrypt_kernel(void) * addressing the workarea. */ ppd.pgd = (pgd_t *)native_read_cr3_pa(); - paddr = workarea_start; - while (paddr < workarea_end) { - ppd.pmd_val = paddr + PMD_FLAGS; - ppd.vaddr = paddr; - sme_populate_pgd_large(&ppd); - - paddr += PMD_PAGE_SIZE; - } + ppd.paddr = workarea_start; + ppd.vaddr = workarea_start; + ppd.vaddr_end = workarea_end; + sme_map_range_decrypted(&ppd); /* Flush the TLB - no globals so cr3 is enough */ native_write_cr3(__native_read_cr3()); @@ -715,17 +746,6 @@ void __init sme_encrypt_kernel(void) memset(ppd.pgd, 0, sizeof(pgd_t) * PTRS_PER_PGD); ppd.pgtable_area += sizeof(pgd_t) * PTRS_PER_PGD; - /* Add encrypted kernel (identity) mappings */ - pmd_flags = PMD_FLAGS | _PAGE_ENC; - paddr = kernel_start; - while (paddr < kernel_end) { - ppd.pmd_val = paddr + pmd_flags; - ppd.vaddr = paddr; - sme_populate_pgd_large(&ppd); - - paddr += PMD_PAGE_SIZE; - } - /* * A different PGD index/entry must be used to get different * pagetable entries for the decrypted mapping. Choose the next @@ -735,29 +755,28 @@ void __init sme_encrypt_kernel(void) decrypted_base = (pgd_index(workarea_end) + 1) & (PTRS_PER_PGD - 1); decrypted_base <<= PGDIR_SHIFT; + /* Add encrypted kernel (identity) mappings */ + ppd.paddr = kernel_start; + ppd.vaddr = kernel_start; + ppd.vaddr_end = kernel_end; + sme_map_range_encrypted(&ppd); + /* Add decrypted, write-protected kernel (non-identity) mappings */ - pmd_flags = (PMD_FLAGS & ~_PAGE_CACHE_MASK) | (_PAGE_PAT | _PAGE_PWT); - paddr = kernel_start; - while (paddr < kernel_end) { - ppd.pmd_val = paddr + pmd_flags; - ppd.vaddr = paddr + decrypted_base; - sme_populate_pgd_large(&ppd); - - paddr += PMD_PAGE_SIZE; - } + ppd.paddr = kernel_start; + ppd.vaddr = kernel_start + decrypted_base; + ppd.vaddr_end = kernel_end + decrypted_base; + sme_map_range_decrypted_wp(&ppd); /* Add decrypted workarea mappings to both kernel mappings */ - paddr = workarea_start; - while (paddr < workarea_end) { - ppd.pmd_val = paddr + PMD_FLAGS; - ppd.vaddr = paddr; - sme_populate_pgd_large(&ppd); - - ppd.vaddr = paddr + decrypted_base; - sme_populate_pgd_large(&ppd); + ppd.paddr = workarea_start; + ppd.vaddr = workarea_start; + ppd.vaddr_end = workarea_end; + sme_map_range_decrypted(&ppd); - paddr += PMD_PAGE_SIZE; - } + ppd.paddr = workarea_start; + ppd.vaddr = workarea_start + decrypted_base; + ppd.vaddr_end = workarea_end + decrypted_base; + sme_map_range_decrypted(&ppd); /* Perform the encryption */ sme_encrypt_execute(kernel_start, kernel_start + decrypted_base, @@ -768,11 +787,13 @@ void __init sme_encrypt_kernel(void) * the decrypted areas - all that is needed for this is to remove * the PGD entry/entries. */ - sme_clear_pgd(ppd.pgd, kernel_start + decrypted_base, - kernel_end + decrypted_base); + ppd.vaddr = kernel_start + decrypted_base; + ppd.vaddr_end = kernel_end + decrypted_base; + sme_clear_pgd(&ppd); - sme_clear_pgd(ppd.pgd, workarea_start + decrypted_base, - workarea_end + decrypted_base); + ppd.vaddr = workarea_start + decrypted_base; + ppd.vaddr_end = workarea_end + decrypted_base; + sme_clear_pgd(&ppd); /* Flush the TLB - no globals so cr3 is enough */ native_write_cr3(__native_read_cr3());