From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755443AbdDRVQb (ORCPT ); Tue, 18 Apr 2017 17:16:31 -0400 Received: from mail-dm3nam03on0070.outbound.protection.outlook.com ([104.47.41.70]:40456 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755867AbdDRVQW (ORCPT ); Tue, 18 Apr 2017 17:16:22 -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 v5 00/32] x86: Secure Memory Encryption (AMD) To: , , , , , , , , , CC: Rik van Riel , Radim =?utf-8?b?S3LEjW3DocWZ?= , Toshimitsu Kani , Arnd Bergmann , Jonathan Corbet , Matt Fleming , "Michael S. Tsirkin" , Joerg Roedel , Konrad Rzeszutek Wilk , Paolo Bonzini , Larry Woodman , Brijesh Singh , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , Dave Young , Thomas Gleixner , Dmitry Vyukov Date: Tue, 18 Apr 2017 16:16:13 -0500 Message-ID: <20170418211612.10190.82788.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: MWHPR14CA0021.namprd14.prod.outlook.com (10.173.227.31) To CY4PR12MB1143.namprd12.prod.outlook.com (10.168.164.135) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 641fd45f-293e-49de-9219-08d486a028d5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:CY4PR12MB1143; X-Microsoft-Exchange-Diagnostics: 1;CY4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LlxSJMXMNI3uXcgXT4Aht4qxi8+af7IcarYKv+Tr0TvIQ22TPGeM24M7Kjy+ZqvnrY;20:BiSbz/EwKytknARBtEQJYiB9PjOdBsfhy7lSaMK+IYW0MAY8HqLcN/B8/rcJBSI6Cc0amh2nrQs/Ji5OUTd7UqC3rQxg9hn8XOLbidPOEKPwmIInNkoFzmrRprShfVbXVu+cs5Uz3XF6jtx4bXdADKmDFG168iRodbWuQ8GzTd97+g+WWAFcHqe8olaCaPDQGp0V1UQ1TSgCK1xtMhBSilx2kQGfDPMFbsppDMu/aKd3GF4gM9vOeT2GEwKetyElGr8DkPbZH7XHMIedjvBrEIkVWlCTrvBieM0jfi/9iTVin+g1pwFVKrwOoBhB5fUuIIjvulrF1wzE0L58a0xM9KLBiIGyTCz+BcPO0Ix27cPfTXn9KALwPt7SwPRLKdOTGhMLowcqurQMojsi7e60Jf4/gjCMZV+ZpXBCeFy+DXvNjfZCACdvttSqs74SiyeYbidY/HFHAzyQx3ioJ2eNDFMrw3+YpQa6OHmA9KNHcHFGkUBsvzTTjDRCY6H5ZhMS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123555025)(20161123562025)(20161123564025)(20161123560025)(6072148);SRVR:CY4PR12MB1143;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1143; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1143;4:vZghbcmDrGC6MwUszdNWiaQWtzDZKROhbfn9cl69HOyLngGZO9zxxWNXM1pqbf8l7XT3ubojQ2FayMyambtwt+FGMxcMhdVrPDCxD1Cik6OYrENgpdUou5o2VJ+kE8viw5+7fviaCmF5ASHcmWOheuZYVCDJDb8erF12SEGwpHOGpF8myb4LUo0kIQNVIsZlOvdQjKkniDG6CyxCvyUW5pzrI6s/QbEZu5HQQqQ76WgCp+oMQk3q420ltq0fa5VUbV48yQ1qbtHCPXwNOSEWRyv4a/09eT20pL9/lxbSZI5V5ztSgFr1oSmYgV6ptYaxEuRG7xpiPaphk2b9Wdw5TYmHSn7agb/opRE+f32xq8W0NXSzQKavyTKuW67tMNF8ycGHCkmM3e94unK7S50/LFo2L7hTM53tFa9IAc9rEnE1fX3YMO9U7D5idXDqvPzWw86vNWcqtkDiHapb5+KubxG1g3da6Xjj2DbEeBQREUSa+MeWQQkklpRTTH7eEIjNA01wJRO26elAzfwcKJ8+4zqgOpjgHOEiWpnbeVnnWosmekCZBqf9bIBBfGdQCr+I+qZMEokp88f3IcXN3RwH31XdT87AzHxzvHo0d6YSPYz74J0s/5qDNxcx74UgtpoGwgmvXRbCJkZHVzx2baQa+raHzctNLQTYvzkUMBY2okRlqXQ8b3L35zkR3oZazyxEo86NAUfnQxFfT13t6ote+KicroLTRZ+ym5HM1lXqJEUhTKFcGKISt37pq6uARGxf87/fnXMnWx71lBsiSgL7Cg== X-Forefront-PRVS: 028166BF91 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39860400002)(39850400002)(39410400002)(39400400002)(39840400002)(39450400003)(86362001)(38730400002)(53936002)(54906002)(97746001)(305945005)(7406005)(966004)(5660300001)(42186005)(9686003)(47776003)(23676002)(55016002)(25786009)(7416002)(50986999)(7736002)(6306002)(66066001)(6506006)(54356999)(53416004)(8676002)(4001350100001)(83506001)(2906002)(189998001)(33646002)(81166006)(103116003)(2201001)(50466002)(1076002)(4326008)(6116002)(230700001)(3846002)(6666003)(921003)(71626007)(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?MTtDWTRQUjEyTUIxMTQzOzIzOkgyTExZNFdLQURFa0hkOTZmSUo0MGp5M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1Gb1zJVTdZTZCLGIYIG9vjAfLXEezzoG3R4F7syDS6GSRsD7fF8h/7FYMCdFnEcb6KWMMMQDIW3MzioIx59uQWFy4oUp9t8TAtrLq7AywKoZ+OvADm9+AZP1WQzwEQiCspZJKD2EhbGnmbqui/wgJfMLqWDaoDOJIfKmvTgdtidRTXDXewMv5WbnHXIqJXMGanfAyFrj4lyGvbZ0zopbaSK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2017 21:16:16.5524 (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 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. Commit d36d99770e40 ("Merge branch 'timers/core'") --- Still to do: - IOMMU enablement support - Investigate using memremap() instead of ioremap_cache() for kdump 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 (32): x86: Documentation for AMD Secure Memory Encryption (SME) x86/mm/pat: Set write-protect cache mode for full PAT support x86, mpparse, x86/acpi, x86/PCI, 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: 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: 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: DMA support for memory encryption swiotlb: Add warnings for use of bounce buffers with SME iommu/amd: Disable AMD IOMMU if memory encryption is active x86, realmode: Check for memory encryption on the APs x86, drm, fbdev: Do not specify encrypted memory for video mappings kvm: x86: svm: Enable Secure Memory Encryption within KVM x86/mm, kexec: Allow kexec to be used with SME x86/mm: Add support to encrypt the kernel in-place x86/boot: Add early cmdline parsing for options with arguments x86: Add sysfs support for Secure Memory Encryption x86/mm: Add support to make use of Secure Memory Encryption Documentation/admin-guide/kernel-parameters.txt | 11 Documentation/x86/amd-memory-encryption.txt | 60 ++ arch/ia64/kernel/efi.c | 4 arch/x86/Kconfig | 26 + arch/x86/boot/compressed/pagetable.c | 7 arch/x86/include/asm/cacheflush.h | 3 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/e820/api.h | 2 arch/x86/include/asm/fixmap.h | 20 + arch/x86/include/asm/init.h | 1 arch/x86/include/asm/io.h | 4 arch/x86/include/asm/irqflags.h | 5 arch/x86/include/asm/kexec.h | 8 arch/x86/include/asm/kvm_host.h | 2 arch/x86/include/asm/mem_encrypt.h | 115 ++++ arch/x86/include/asm/msr-index.h | 2 arch/x86/include/asm/page.h | 4 arch/x86/include/asm/page_types.h | 2 arch/x86/include/asm/pgtable.h | 28 + arch/x86/include/asm/pgtable_types.h | 54 +- arch/x86/include/asm/processor.h | 3 arch/x86/include/asm/realmode.h | 12 arch/x86/include/asm/vga.h | 13 arch/x86/kernel/acpi/boot.c | 6 arch/x86/kernel/cpu/amd.c | 23 + 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 | 42 +- arch/x86/kernel/head_64.S | 80 +++ arch/x86/kernel/kdebugfs.c | 34 - arch/x86/kernel/ksysfs.c | 28 + arch/x86/kernel/machine_kexec_64.c | 35 + arch/x86/kernel/mpparse.c | 106 +++- arch/x86/kernel/pci-dma.c | 11 arch/x86/kernel/pci-nommu.c | 2 arch/x86/kernel/pci-swiotlb.c | 8 arch/x86/kernel/process.c | 26 + arch/x86/kernel/setup.c | 10 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 | 3 arch/x86/mm/ident_map.c | 11 arch/x86/mm/ioremap.c | 255 +++++++++ arch/x86/mm/kasan_init_64.c | 4 arch/x86/mm/mem_encrypt.c | 626 +++++++++++++++++++++++ arch/x86/mm/mem_encrypt_boot.S | 151 ++++++ arch/x86/mm/pageattr.c | 67 ++ arch/x86/mm/pat.c | 6 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 | 16 + arch/x86/realmode/rm/trampoline_64.S | 24 + drivers/firmware/efi/efi.c | 33 + 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_init.c | 7 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 | 8 include/linux/dma-mapping.h | 11 include/linux/efi.h | 9 include/linux/io.h | 2 include/linux/kexec.h | 14 + include/linux/mem_encrypt.h | 53 ++ include/linux/swiotlb.h | 1 init/main.c | 13 kernel/kexec_core.c | 7 kernel/memremap.c | 20 + lib/swiotlb.c | 59 ++ mm/early_ioremap.c | 28 + 81 files changed, 2293 insertions(+), 207 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