Received: by 10.223.176.5 with SMTP id f5csp557875wra; Tue, 30 Jan 2018 15:54:29 -0800 (PST) X-Google-Smtp-Source: AH8x226UF+fFo9HPssnsgJJy2gjBtUjpUWg+E8UKgNsYH6OEDe5qGFWI/Vq8nUKe0YAOp3oB5x4D X-Received: by 10.99.95.3 with SMTP id t3mr24313125pgb.302.1517356469422; Tue, 30 Jan 2018 15:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517356469; cv=none; d=google.com; s=arc-20160816; b=bEmlMboFtHB1llNiUNI0tTD9cvloR0pRvrnurlyqzOmNic9rn6JUJPSrDL+SP23nyu GiSwwH+qpPcJzKXSUNnch4IiH5Vkr7xdLDXOcJ2kGr9GFIFCQjOjyCQJ+zozBZP3T9zM 89XvlJ9gWAsa/4C5UgPmhXMaqSBRkQ6mwTFRnPe0Wr5m+zLqK+dYjnjqxSdjxJg/tQvt Q1li9rmpF/uFY0BbqscsTP8QghoP1NUdhf8C690s6nYSRlp2C0FpI8Hz98HptlL9P9R6 j9mG0aTGc8yP5j/pYm24Rrou+vhjMhqKy7C6sVvi9d1HFHazhyr3tgec1pal0hHBbGt3 VLNA== 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:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=lTQN5bTOgRkFDepldXKWdc3k6yxMTHNVher+tUYOX1Q=; b=PhL0V3iudkKgYHmBikPiY88rGmgDor9i1ROQKYqzFnOz1TtsUG3S8YLANm+uyc/sDa nEtsG2Wq8VdCtXwzSW8r0Nrva33qAR15mdMpuuDiT+zFL+3nwP/z5rLrOFHJ9KSKzV7k U9nPhqXfKSoXjyWLyRJzSwanKblMsvVEDAtcCDqfNB9V/KABsATj/WqVnxvA6X+0NJHC gIHCb8VNUJGLyy5o5aylF0rdtZyUQQFNapkF70BejMtPrELqgITxv7qjG2hUnUb91BJ5 emCC5C6XCWXCXK/6+3naIP8ahq57aVN9yDY1CqnxotxDg014flRd2hAuk/dluoUAPIst sRgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=Sdoe7VSx; 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 x16-v6si129808pll.736.2018.01.30.15.54.14; Tue, 30 Jan 2018 15:54:29 -0800 (PST) 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=Sdoe7VSx; 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 S1753837AbeA3WwX (ORCPT + 99 others); Tue, 30 Jan 2018 17:52:23 -0500 Received: from mail-by2nam03on0059.outbound.protection.outlook.com ([104.47.42.59]:22977 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753615AbeA3WwV (ORCPT ); Tue, 30 Jan 2018 17:52:21 -0500 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=lTQN5bTOgRkFDepldXKWdc3k6yxMTHNVher+tUYOX1Q=; b=Sdoe7VSx/md9mQSmKYmvNn+xR17LqrQgU5Qk+bwrqE1gqedVtRjAm5r50e0Hws1qVSSlnPoQJd+SDGR2tMpubsrzL+9AwKlDFuim6UfRBLE4I9bqUN/lG5M1YVLmqf+wL0EYbsp/tUpAR5Qwld3IGf5a7aDl87LqCycT8G2VJXI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from [10.236.65.116] (165.204.78.1) by CY4PR12MB1141.namprd12.prod.outlook.com (10.168.163.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Tue, 30 Jan 2018 22:52:18 +0000 Subject: Re: [PATCHv3 0/3] x86/mm/encrypt: Cleanup and switching between paging modes To: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" Cc: Linus Torvalds , Borislav Petkov , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20180124163623.61765-1-kirill.shutemov@linux.intel.com> From: Tom Lendacky Message-ID: <830ed299-53a7-f357-9301-5b6577d55f30@amd.com> Date: Tue, 30 Jan 2018 16:52:13 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180124163623.61765-1-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: BN6PR14CA0048.namprd14.prod.outlook.com (10.171.172.162) To CY4PR12MB1141.namprd12.prod.outlook.com (10.168.163.149) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 938b7d9d-1f44-4c6f-a782-08d568341dff X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:CY4PR12MB1141; X-Microsoft-Exchange-Diagnostics: 1;CY4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8YgeWS10GqBdAbyrGFECkN0qyrX38wBLqsHV3PpAMCBEo4FNGmdvsyWQrAzfqfM8gLU9SzjkbhUygndyZgyI9bSsNR0Wp66ybQrwgBHEjBiuZKLgWElfUmXcmT7rBiwTYTNEqHEhY6RdkidoHEcv3pxflVgnRvnnzX9ehG/B1WRdRkFPKxy/32KX6CznOf6AN3fUrzaCXQKg2k9vpPUaO+lFt7TqKTLmfkZf8aQC6ROOhy5k2PXSTFeq7iGpqWwPB0qfZyW5VcogPs9hoQZkfjmLx93wFa0eg0dFAJlA2vYcZRQhXjPSuZ+kZzLtzU/dSnzxrr5SW+1NeE4ZcFZJj6Vtg7hLLkikB5G+Tu5;4:TfhkofHhjL1k/A5GDI9PBNbhzHGW8/r8JfUblTyQXqPH1xW4lRxsUbmWityKNtLjVoQbKmcY7yczPkv831OMuLYtWWliPSR+WnZkl9yQhcUoiRf1gK4DZW97sELCNVaO0gYQxXxzp3lA2v3QRcvJZjHoYMbkqbaVTpNFf1aBFsTDn0/3h28OS80CrGCjDGLc1xxPEQDxXC/SNXH/tKBmWS3LZ+bEql4B4iznt4Xd5xpcn06VsDCD68d0ElPjAWO5xnJDIyxBGLXFgXaRzW9yB0nbz5t2s057BvroUrHJJERx0+k/kP2ryXo2+Y976S0E X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231101)(944501161)(6055026)(6041288)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:CY4PR12MB1141;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1141; X-Forefront-PRVS: 0568F32D91 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(396003)(366004)(39860400002)(376002)(346002)(39380400002)(189003)(199004)(23676004)(52116002)(386003)(53546011)(58126008)(31686004)(77096007)(76176011)(52146003)(16576012)(66066001)(65806001)(2486003)(64126003)(65956001)(83506002)(25786009)(47776003)(97736004)(50466002)(81166006)(6246003)(106356001)(316002)(3260700006)(81156014)(230700001)(68736007)(8676002)(26005)(72206003)(36756003)(86362001)(8936002)(6666003)(54906003)(2906002)(4326008)(53936002)(305945005)(65826007)(5660300001)(110136005)(2950100002)(186003)(7736002)(105586002)(90366009)(3846002)(16526019)(229853002)(6486002)(31696002)(6116002)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1141;H:[10.236.65.116];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQxOzIzOlZFSzhQa0h6WTIwNlVjY29pSWttTVNnQzU5?= =?utf-8?B?TFl3bFBRNWZlREFaMFI3ZkowR2FXR005K1E2MmVKVzhmbjFuWmJQVHgxbnM3?= =?utf-8?B?VjlRY3BwQzBIYmhrdkhqMjN6TW5JcDRzWG9RMFRqejJJaU95MUFUYjNUbE8r?= =?utf-8?B?SEJjTkI5SHRTTUUvSWQvczd3RjRPWjdUMjZKdnpEcE5BQUpyYWJ0V1BwQytm?= =?utf-8?B?SmsyL3JoVUFMajJwQ0tRRzBVeXA5b2VpZUN2YWhURi9ld0xucGk0ZU9SeFFL?= =?utf-8?B?WkUwc1hhTEkrenUwaHlLTU9FWU5SNEp0Z09LKzhEMkEyWU5DTGJHSjlWa0VL?= =?utf-8?B?d0tYRlZObHNlSGczL0pQMDl0TDMzYzBjRlJZUFFrRjJTSnJ4UDZxQUVOYlNj?= =?utf-8?B?Ymk4MFRuR3RTSHhTUnNIWll4c3JMS3Qxb3hPRURkbTAzTVp6dmJJSXpYaUlU?= =?utf-8?B?emFBK01oUUpadmp4a0JGNmpFT0tPWTlySnRKSW04Q2N0QzVnW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ovmgwhF6yjqX4pQFPKFi0+qKTTnhxAiTtdUZxUnGRT73qekzXaEdUyzW3o9FZKZ71jGddD6XN0AGse+i7ZVL8GNLgQtrB4QdfZLjfpCt8fbCxN9TbF9Q1tGQ1uU6MXQNUP4fuYZ1dP7BtITIDSG8=;24:3lYLbAPKBdLQoeyXL0u0Cvdy+EvdZCp7t3Rgp4XawRG7O/HDZPqlFQYfrosaBFsil6G5iFaXwYdDpEkhwuWY/i2X05/jCrMlfjexuS70M1E=;7:ioCEcDox/EII0Vh103IWOp8Iv332bx27DzVjFdwq5OH2yNLEZLj9psws6x1IOEk6+MNcIiKOkSQsaH6RrGBXIS+PYZgq12cMMzHU9wspUVYVmsiruVVyHxmX2W/+0UilCll0YDtigK+G39O3/Fbf8/pbvKma9hQnxW8fKj89FYRQr+d5T0cRiv6a1l0lkMiYM9C1EI/n1s+5BbxVI4uZ7rI+A4eb/l9wcxzpg+F6Lchq/vzKML4Jq0SCyFViYxUt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;20:TE/dYjfiEpKSVVXD/D8J1xDgQe6fET+lI51BvGcmnMe7kuXyAzCyj685lSm+VcjRVcdzCdZnw8wtEW6s93rIEMJJRTp97+/3xGcx+BxAUhz0PqH2Q3HOUZudayObivYM+vHWSjws/YG8zaoe8gkaFsVcrQxtFolLuY8hBmMzQJqcqSR7lyjTOW+GvRYMe64DwgSbp8u1i4lNiZN1eowwcctWnlDydiVFvsI6FdNH4BqN8fmcRGDTUo/3RVgDZZWL X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2018 22:52:18.0706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 938b7d9d-1f44-4c6f-a782-08d568341dff X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1141 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/2018 10:36 AM, Kirill A. Shutemov wrote: > This patcheset is a preparation set for boot-time switching between > paging modes. Please review and consider applying. > > Code around sme_populate_pgd() is unnecessary complex and hard to modify. > > This patchset rewrites it in more stream-lined way to add support of > boot-time switching between paging modes. > > I haven't tested the patchset on hardware capable of memory encryption. Tested-by: Tom Lendacky > > v3: > - Move all page table related functions into mem_encrypt_identity.c > v2: > - Rebased to up-to-date tip > > Kirill A. Shutemov (3): > x86/mm/encrypt: Move page table helpers into separate translation unit > x86/mm/encrypt: Rewrite sme_populate_pgd() and > sme_populate_pgd_large() > x86/mm/encrypt: Rewrite sme_pgtable_calc() > > arch/x86/mm/Makefile | 14 +- > arch/x86/mm/mem_encrypt.c | 578 +------------------------------------ > arch/x86/mm/mem_encrypt_identity.c | 563 ++++++++++++++++++++++++++++++++++++ > arch/x86/mm/mm_internal.h | 1 + > 4 files changed, 574 insertions(+), 582 deletions(-) > create mode 100644 arch/x86/mm/mem_encrypt_identity.c >