Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbdGGNiV (ORCPT ); Fri, 7 Jul 2017 09:38:21 -0400 Received: from mail-cys01nam02on0074.outbound.protection.outlook.com ([104.47.37.74]:9243 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751013AbdGGNiP (ORCPT ); Fri, 7 Jul 2017 09:38:15 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; From: Tom Lendacky Subject: [PATCH v9 00/38] x86: Secure Memory Encryption (AMD) To: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, xen-devel@lists.xen.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org Cc: Brijesh Singh , Toshimitsu Kani , Radim =?utf-8?b?S3LEjW3DocWZ?= , Matt Fleming , Alexander Potapenko , "H. Peter Anvin" , Larry Woodman , Jonathan Corbet , Joerg Roedel , "Michael S. Tsirkin" , Ingo Molnar , Andrey Ryabinin , Dave Young , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Borislav Petkov , Andy Lutomirski , Boris Ostrovsky , Dmitry Vyukov , Juergen Gross , Thomas Gleixner , Paolo Bonzini Date: Fri, 07 Jul 2017 08:38:05 -0500 Message-ID: <20170707133804.29711.1616.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: MWHPR06CA0019.namprd06.prod.outlook.com (10.174.172.160) To CY4PR12MB1143.namprd12.prod.outlook.com (10.168.164.135) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e6950905-11cf-4075-833e-08d4c53d6957 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY4PR12MB1143; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1143;3:EIbqA/lYGjIQYwYkI+q8g0v+NNy3fRTebHBdYNOMC8p2MIU1/EqCkkrcRyKSnCWLqaBdgrE4W5TgSXfF1NWuCeiWWe/gTLDP5fzlDsgOxUKf1Z3jX3koSNMLwXQ5N/sB/57LYBIE62Ojwb2fsu+ip2QKqEb3v8lG4S969qV7STDpdeuRODzeLGheN/5xVgJt1EjloWEiak0i3I+jjlSpEU6yKafdFC8Rk4BAgAgs/LrIT/kDkSNPsgNp7dwNm6/n6wt+/eEUpc8oBXKFwVWqZaUV4LfX6/t3mcRnrFdumsxMWmlgtFam6HE7XHJ+nNTYVMFRMGAzm9QaYX+3+LJsAc13y/1s0CuqUEgS31XYbm5ohLlyzIbLrFoZYU5Mev9IvbbsUGvL8oPEZ2rQy6jkxdmx98Kv+fXLHKoHls41wUq36mRJ7lPZi6kY4X1agZQgi1iKEckR6xoxoKSLgsIF4uL4bs8RNP7VpQv2vzZ4NWiSo01jWZDYbpKAxUlcQ3bk11/uOgLV2G7xSGZk3ACx8WonfQ1NBLJbiXZ+9r6vD0f8OLDZQA7mRzYL4tTpMVlH9IAWaGKcqxIJIbTbaxZAO4FN6HjtERp8e0MrcKt8iksKdaPbcClDzVuZc2B9yAARNRQqwdc41gVGnUSsiTh5Yb5G5/QpnFRyqrXWJqnEgsYdUiFOKif4hrf30rSpfZhIBKnAcNNsl6qonrgSeBQOFfBv6KzBiaD2fSicmWalqlRqKgIrm4vMgbIYtIKPbbn5EhHpCq1EgoiCxuKBmveJug== X-MS-TrafficTypeDiagnostic: CY4PR12M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0nPauUmqfc6V4pi2updKCNkcf1Vcv5MkmzsCkLnFLg7zjrQPn3FAAgKbvJBlMMgQWo+qJB8MoTu4OHmodN8wwe0Hk9Utj5Ku4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(125551606395959)(278178393323532)(133145235818549)(166708455590820)(236129657087228)(767451399110)(148574349560750)(84791874153150)(167848164394848); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(2017060910064)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR12MB1143;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR12MB1143; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQzOzQ6U1FsTFhRRTlzcDU4SHNmeDA3cC9hTkp6UG5D?= =?utf-8?B?Q09oWWpidW5jSllWNmREb0RJd2FIWURFYUFNeFQzdDFLcUQwVHZzT0R3dW5r?= =?utf-8?B?L0luaDltTVA1SFFPQVFCekpXNVhnV3U3WGtodEFJS2hkMHFIbHNtYWtJNit2?= =?utf-8?B?WHdZeE5pcUJUbUhmOHZPYTRSdzNqeHlRaEt4S1MxdHhkeDlOdm93ZldsUWF1?= =?utf-8?B?MkZZSmttYm5kWlA2Y2IxeTJFcUFJOHVOZlloOUhyamZ4Umo5V1lxSTFwSmNF?= =?utf-8?B?amgvSklERlI4dW15SW9CRTFuME5OOE5YdGd5NWdBd1phejFTYVNORFZKUkQ3?= =?utf-8?B?eW1GL2QwMFVaZnc2K1RycFZt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B?eTZ0VDJMbHE4M0ZRK3Via05OOG5lczJuMWk3Y3F1SytqMHNhUlpyVHROWXRR?= =?utf-8?B?cUZrL2VHMHJvZHkyZUZmdDFySjM3NFhoTThINzFBR05KMHVWVjBJZTdRamRW?= =?utf-8?B?b0JWektSNVByeC85SlNZVnc1LzNaRTN4ZzJoTTVhRXdEdkY5YmV1eW05dENj?= =?utf-8?B?aFpnUFBnMytKWGZFZ2htZ3VLQXFaYnQvRWsrZHo3czBwNU4yUllWVk5CdGVo?= =?utf-8?B?bjFsWStLc3F0NXZiUndjT2gzSmgyalJkcXZIbUUzeldjOEl5NjcrMU1wQkRD?= =?utf-8?B?VlJnMnZrVVZyTS9kQnB5Q1FLVnYraFBZS05VTm9OdGhKcmZBV2JZWWpyUmxy?= =?utf-8?B?OUk3Z21qVG0vZlRkbnRWejNhZERWTCtIQXZ4NlJRbUN2M1Bibzk4SVFPbUU4?= =?utf-8?B?TWxrNnFDaGtqV3FPSVJHenNrNWY4MUU5RnhWUGl4TmUwdWQ2QUZLdUU5UHlL?= =?utf-8?B?MGg2Zk10MzM3NWxjOHBzVng5L0ZwNlNMRFozMFBYbDdVOUdtWTVNYmVEOW1y?= =?utf-8?B?VkRBeWpHcUQ4NmZPNmZmaVJSZkkzM1BDTFdxeHdCZVc4TUs2UlUrQVRkS1Ba?= =?utf-8?B?SnhYaWxkbEk1RmVEWWlYMXZNT0VKVHltaTNHdEVuMTBlRjFDSjlURkF1Tk1R?= =?utf-8?B?MHRrb1lEeWhIbmZTK2dZTHZicWErWnJTVVNPcndxaVJleURQd2JCWVNHTkhX?= =?utf-8?B?K0ZZa042U0lObmkxR3NMaS9nMDlyQmhlVisxTXB3cm0zYytKUTU3VVNjOWZI?= =?utf-8?Q?5I0NkLiD2Xyp5HVKfJJsHiXG?= X-Forefront-PRVS: 0361212EA8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39850400002)(39410400002)(39860400002)(39400400002)(39840400002)(39450400003)(83506001)(7736002)(25786009)(9686003)(110136004)(38730400002)(23676002)(189998001)(4326008)(42186005)(47776003)(53416004)(97746001)(230700001)(86362001)(305945005)(2906002)(6506006)(81166006)(7406005)(3846002)(5660300001)(50466002)(33646002)(7416002)(66066001)(1076002)(966005)(54356999)(8676002)(72206003)(54906002)(55016002)(6306002)(50986999)(103116003)(478600001)(6116002)(6666003)(53936002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1143;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQzOzIzOk55YkVIMW4yTDBRV0UxZGl4c01DNlpYdk4z?= =?utf-8?B?S1FyaFp0eVhIM0RtRGxLZU05UFhtK3drMDhkem5PSklIZWtvN0pKWk83RWFM?= =?utf-8?B?d3gvSlZiZmVURllQeXF2em42dUwydm5ibFg5WVozVTE0dXA5SWtvbkRxVTdl?= =?utf-8?B?U2Z2eWpUZ21PaVQrVHVYbWg3QzV4eWdIOXRRWUJpTDVUREMyOGttMDZ1QjJN?= =?utf-8?B?c3lMYmZpV28xZkFmV2xCeXZCUnhVYzFBNGxoLzk1ZHFjQm5UQVMxbS9WZjVE?= =?utf-8?B?WmU0RXF2WnFFR3dOVVhIbDVlYWdIWXVUZ1N4QmJZYytRcmZzajQya3J1L2JU?= =?utf-8?B?eVBpZ2VYYWNreEdhaEc4WHF1YXdpVlV5bmpOdGcwL0QzbHJWZWtkclNLVkpw?= =?utf-8?B?RWFkeE43bnJaS25tVmw5cUNhVk1hRUY2L3lIb1FjcE5zVm80cExOOW0rKzMr?= =?utf-8?B?cittWkh3b0dqTlJaanhPcW82UThiZi9zeWJuU3gxSjhDYVdUbFIxUUpBSkYw?= =?utf-8?B?ZEtWRzZqNTdYd0h3MUNIOEU0VkptTEtobGxkMGcrL1lCSHZGbXlINlpRVU0r?= =?utf-8?B?c2NTVDA2RDRsK3diaVFVNTN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tTNv0FCFQtSWZMZp58bgWxneiNqyltjx3BISwvHlmj3en6zD4dsOYR4TILlWTUNfqkXrhlFx/hevySUXspRmByuvpFqQDJ4bf4UsyqGh/Ts3kWWpu0mqZdXWQw6sk20I2xqGHixSB06tBCO48I3i+RajjIbWO6Nq197WNsF54rWMhOBT1x58R1bN5ASoLmlmN7LLL388izB8b0M= X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1143;20:qLOqq2XUywsv0PQfPyjaTAnmVigsN19s+CiNQGMRQlnSZpJWgAc+tMXlmJrGuuCLnYkOA+FDqJK1nd1x7XhfQl/5olfjb9vmuzt4yAUpOx0Gwn/JnX9lOAmjDorDNA3qofnBYhmITplRJuO2Tsn5AxxI/QK4XRkLVIH/D4aqC5ByDuJkd78z/QcEorA2rzzDdIYFICiyA7s2mSqDnGdX0quy0ekW2oIEtnmREhJyAQ6taijkPiYVaD1bAbfHUO02 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2017 13:38:08.8908 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1143 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 15464 Lines: 307 This patch series provides support for AMD's new Secure Memory Encryption (SME) feature. SME can be used to mark individual pages of memory as encrypted through the page tables. A page of memory that is marked encrypted will be automatically decrypted when read from DRAM and will be automatically encrypted when written to DRAM. Details on SME can found in the links below. The SME feature is identified through a CPUID function and enabled through the SYSCFG MSR. Once enabled, page table entries will determine how the memory is accessed. If a page table entry has the memory encryption mask set, then that memory will be accessed as encrypted memory. The memory encryption mask (as well as other related information) is determined from settings returned through the same CPUID function that identifies the presence of the feature. The approach that this patch series takes is to encrypt everything possible starting early in the boot where the kernel is encrypted. Using the page table macros the encryption mask can be incorporated into all page table entries and page allocations. By updating the protection map, userspace allocations are also marked encrypted. Certain data must be accounted for as having been placed in memory before SME was enabled (EFI, initrd, etc.) and accessed accordingly. This patch series is a pre-cursor to another AMD processor feature called Secure Encrypted Virtualization (SEV). The support for SEV will build upon the SME support and will be submitted later. Details on SEV can be found in the links below. The following links provide additional detail: AMD Memory Encryption whitepaper: http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf AMD64 Architecture Programmer's Manual: http://support.amd.com/TechDocs/24593.pdf SME is section 7.10 SEV is section 15.34 --- This patch series is based off of the master branch of tip: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master Commit 463bd921e365 ("Merge branch 'x86/mm'") Source code is also available at https://github.com/codomania/tip/tree/sme-v9 Still to do: - Kdump support, including using memremap() instead of ioremap_cache() Changes since v8: - Changed AMD IOMMU SME-related function name - Updated the sme_encrypt_kernel() entry/exit code to address new warnings issued by objtool Changes since v7: - Fixed kbuild test robot failure related to pgprot_decrypted() macro usage for some non-x86 archs - Moved calls to encrypt the kernel and retrieve the encryption mask from assembler (head_64.S) into C (head64.c) - Removed use of phys_to_virt() in __ioremap_caller() when address is in the ISA range. Now regular ioremap() processing occurs. - Two new, small patches: - Introduced a native_make_p4d() for use when CONFIG_PGTABLE_LEVELS is not greater than 4 - Introduced __nostackp GCC option to turn off stack protection on a per function basis - General code cleanup based on feedback Changes since v6: - Fixed the asm include file issue that caused build errors on other archs - Rebased the CR3 register changes on top of Andy Lutomirski's patch - Added a patch to clear the SME cpu feature if running as a PV guest under Xen - Added a patch to obtain the AMD microcode level earlier in the boot instead of directly reading the MSR - Refactor patch #8 ("x86/mm: Add support to enable SME in early boot processing") because the 5-level paging support moved the code into the new C-function __startup_64() - Removed need to decrypt trampoline area in-place (set memory attributes before copying the trampoline code) - General code cleanup based on feedback Changes since v5: - Added support for 5-level paging - Added IOMMU support - Created a generic asm/mem_encrypt.h in order to remove a bunch of #ifndef/#define entries - Removed changes to the __va() macro and defined a function to return the true physical address in cr3 - Removed sysfs support as it was determined not to be needed - General code cleanup based on feedback - General cleanup of patch subjects and descriptions Changes since v4: - Re-worked mapping of setup data to not use a fixed list. Rather, check dynamically whether the requested early_memremap()/memremap() call needs to be mapped decrypted. - Moved SME cpu feature into scattered features - Moved some declarations into header files - Cleared the encryption mask from the __PHYSICAL_MASK so that users of macros such as pmd_pfn_mask() don't have to worry/know about the encryption mask - Updated some return types and values related to EFI and e820 functions so that an error could be returned - During cpu shutdown, removed cache disabling and added a check for kexec in progress to use wbinvd followed immediately by halt in order to avoid any memory corruption - Update how persistent memory is identified - Added a function to find command line arguments and their values - Added sysfs support - General code cleanup based on feedback - General cleanup of patch subjects and descriptions Changes since v3: - Broke out some of the patches into smaller individual patches - Updated Documentation - Added a message to indicate why the IOMMU was disabled - Updated CPU feature support for SME by taking into account whether BIOS has enabled SME - Eliminated redundant functions - Added some warning messages for DMA usage of bounce buffers when SME is active - Added support for persistent memory - Added support to determine when setup data is being mapped and be sure to map it un-encrypted - Added CONFIG support to set the default action of whether to activate SME if it is supported/enabled - Added support for (re)booting with kexec Changes since v2: - Updated Documentation - Make the encryption mask available outside of arch/x86 through a standard include file - Conversion of assembler routines to C where possible (not everything could be converted, e.g. the routine that does the actual encryption needs to be copied into a safe location and it is difficult to determine the actual length of the function in order to copy it) - Fix SME feature use of scattered CPUID feature - Creation of SME specific functions for things like encrypting the setup data, ramdisk, etc. - New take on early_memremap / memremap encryption support - Additional support for accessing video buffers (fbdev/gpu) as un-encrypted - Disable IOMMU for now - need to investigate further in relation to how it needs to be programmed relative to accessing physical memory Changes since v1: - Added Documentation. - Removed AMD vendor check for setting the PAT write protect mode - Updated naming of trampoline flag for SME as well as moving of the SME check to before paging is enabled. - Change to early_memremap to identify the data being mapped as either boot data or kernel data. The idea being that boot data will have been placed in memory as un-encrypted data and would need to be accessed as such. - Updated debugfs support for the bootparams to access the data properly. - Do not set the SYSCFG[MEME] bit, only check it. The setting of the MemEncryptionModeEn bit results in a reduction of physical address size of the processor. It is possible that BIOS could have configured resources resources into a range that will now not be addressable. To prevent this, rely on BIOS to set the SYSCFG[MEME] bit and only then enable memory encryption support in the kernel. Tom Lendacky (38): x86: Document AMD Secure Memory Encryption (SME) x86/mm/pat: Set write-protect cache mode for full PAT support x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use memremap for RAM mappings x86/CPU/AMD: Add the Secure Memory Encryption CPU feature x86/CPU/AMD: Handle SME reduction in physical address size x86/mm: Add Secure Memory Encryption (SME) support x86/mm: Remove phys_to_virt() usage in ioremap() x86/mm: Add support to enable SME in early boot processing x86/mm: Simplify p[g4um]d_page() macros x86/mm: Provide general kernel support for memory encryption x86/mm: Add SME support for read_cr3_pa() x86/mm: Extend early_memremap() support with additional attrs x86/mm: Add support for early encrypt/decrypt of memory x86/mm: Insure that boot memory areas are mapped properly x86/boot/e820: Add support to determine the E820 type of an address efi: Add an EFI table address match function efi: Update efi_mem_type() to return an error rather than 0 x86/efi: Update EFI pagetable creation to work with SME x86/mm: Add support to access boot related data in the clear x86, mpparse: Use memremap to map the mpf and mpc data x86/mm: Add support to access persistent memory in the clear x86/mm: Add support for changing the memory encryption attribute x86/realmode: Decrypt trampoline area if memory encryption is active x86, swiotlb: Add memory encryption support swiotlb: Add warnings for use of bounce buffers with SME x86/CPU/AMD: Make the microcode level available earlier in the boot iommu/amd: Allow the AMD IOMMU to work with memory encryption x86, realmode: Check for memory encryption on the APs x86, drm, fbdev: Do not specify encrypted memory for video mappings kvm: x86: svm: Support Secure Memory Encryption within KVM x86/mm, kexec: Allow kexec to be used with SME xen/x86: Remove SME feature in PV guests x86/mm: Use proper encryption attributes with /dev/mem x86/mm: Create native_make_p4d() for PGTABLE_LEVELS <= 4 x86/mm: Add support to encrypt the kernel in-place x86/boot: Add early cmdline parsing for options with arguments compiler-gcc.h: Introduce __nostackp function attribute x86/mm: Add support to make use of Secure Memory Encryption Documentation/admin-guide/kernel-parameters.txt | 11 Documentation/x86/amd-memory-encryption.txt | 68 +++ arch/ia64/kernel/efi.c | 4 arch/x86/Kconfig | 29 + arch/x86/boot/compressed/pagetable.c | 7 arch/x86/include/asm/cmdline.h | 2 arch/x86/include/asm/cpufeatures.h | 1 arch/x86/include/asm/dma-mapping.h | 5 arch/x86/include/asm/dmi.h | 8 arch/x86/include/asm/e820/api.h | 2 arch/x86/include/asm/fixmap.h | 20 + arch/x86/include/asm/init.h | 1 arch/x86/include/asm/io.h | 8 arch/x86/include/asm/kexec.h | 8 arch/x86/include/asm/kvm_host.h | 2 arch/x86/include/asm/mem_encrypt.h | 80 +++ arch/x86/include/asm/msr-index.h | 2 arch/x86/include/asm/page_types.h | 3 arch/x86/include/asm/pgtable.h | 28 + arch/x86/include/asm/pgtable_types.h | 57 ++ arch/x86/include/asm/processor-flags.h | 5 arch/x86/include/asm/processor.h | 8 arch/x86/include/asm/realmode.h | 12 arch/x86/include/asm/set_memory.h | 3 arch/x86/include/asm/vga.h | 14 + arch/x86/kernel/acpi/boot.c | 6 arch/x86/kernel/cpu/amd.c | 25 + arch/x86/kernel/cpu/scattered.c | 1 arch/x86/kernel/e820.c | 26 + arch/x86/kernel/espfix_64.c | 2 arch/x86/kernel/head64.c | 93 +++- arch/x86/kernel/head_64.S | 40 +- arch/x86/kernel/kdebugfs.c | 34 - arch/x86/kernel/ksysfs.c | 28 + arch/x86/kernel/machine_kexec_64.c | 22 + arch/x86/kernel/mpparse.c | 108 +++- arch/x86/kernel/pci-dma.c | 11 arch/x86/kernel/pci-nommu.c | 2 arch/x86/kernel/pci-swiotlb.c | 15 + arch/x86/kernel/process.c | 17 + arch/x86/kernel/setup.c | 9 arch/x86/kvm/mmu.c | 12 arch/x86/kvm/mmu.h | 2 arch/x86/kvm/svm.c | 35 + arch/x86/kvm/vmx.c | 3 arch/x86/kvm/x86.c | 3 arch/x86/lib/cmdline.c | 105 ++++ arch/x86/mm/Makefile | 2 arch/x86/mm/ident_map.c | 12 arch/x86/mm/ioremap.c | 275 ++++++++++- arch/x86/mm/kasan_init_64.c | 6 arch/x86/mm/mem_encrypt.c | 593 +++++++++++++++++++++++ arch/x86/mm/mem_encrypt_boot.S | 149 ++++++ arch/x86/mm/pageattr.c | 67 +++ arch/x86/mm/pat.c | 9 arch/x86/mm/tlb.c | 4 arch/x86/pci/common.c | 4 arch/x86/platform/efi/efi.c | 6 arch/x86/platform/efi/efi_64.c | 15 - arch/x86/realmode/init.c | 12 arch/x86/realmode/rm/trampoline_64.S | 24 + arch/x86/xen/enlighten_pv.c | 1 drivers/firmware/dmi-sysfs.c | 5 drivers/firmware/efi/efi.c | 33 + drivers/firmware/pcdp.c | 4 drivers/gpu/drm/drm_gem.c | 2 drivers/gpu/drm/drm_vm.c | 4 drivers/gpu/drm/ttm/ttm_bo_vm.c | 7 drivers/gpu/drm/udl/udl_fb.c | 4 drivers/iommu/amd_iommu.c | 30 + drivers/iommu/amd_iommu_init.c | 34 + drivers/iommu/amd_iommu_proto.h | 10 drivers/iommu/amd_iommu_types.h | 2 drivers/sfi/sfi_core.c | 22 - drivers/video/fbdev/core/fbmem.c | 12 include/asm-generic/early_ioremap.h | 2 include/asm-generic/pgtable.h | 12 include/linux/compiler-gcc.h | 2 include/linux/compiler.h | 4 include/linux/dma-mapping.h | 13 + include/linux/efi.h | 9 include/linux/io.h | 2 include/linux/kexec.h | 8 include/linux/mem_encrypt.h | 48 ++ include/linux/swiotlb.h | 1 init/main.c | 10 kernel/kexec_core.c | 12 kernel/memremap.c | 20 + lib/swiotlb.c | 57 ++ mm/early_ioremap.c | 28 + 90 files changed, 2294 insertions(+), 269 deletions(-) create mode 100644 Documentation/x86/amd-memory-encryption.txt create mode 100644 arch/x86/include/asm/mem_encrypt.h create mode 100644 arch/x86/mm/mem_encrypt.c create mode 100644 arch/x86/mm/mem_encrypt_boot.S create mode 100644 include/linux/mem_encrypt.h -- Tom Lendacky