Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753209AbdGGNnl (ORCPT ); Fri, 7 Jul 2017 09:43:41 -0400 Received: from mail-by2nam03on0086.outbound.protection.outlook.com ([104.47.42.86]:42947 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752966AbdGGNnb (ORCPT ); Fri, 7 Jul 2017 09:43:31 -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 28/38] x86, realmode: Check for memory encryption on the APs 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:43:21 -0500 Message-ID: <20170707134321.29711.24235.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20170707133804.29711.1616.stgit@tlendack-t1.amdoffice.net> References: <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: BN6PR03CA0048.namprd03.prod.outlook.com (10.175.124.34) To CY4PR12MB1141.namprd12.prod.outlook.com (10.168.163.149) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46cedc74-b562-474a-7c63-08d4c53e25bc 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:CY4PR12MB1141; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;3:5B6svQzumze+gcbweH1L1sgv5ybY0M663oeAyP++k5FT1wV1Q72aTVgcs+XQTgCKTzmm2nqtJPLZdY77QQ1eAwTIjmDshtyF496dVuQ6rGe/B3NS7gizML29NA0Ck3EUtV1ca4uvQ2u2Dhaxev5P4A2itlN2ZXypCCHfTUcrUemzIlBZFYcj6zfkt+6R9AWm77Iov2COx2NiwO/3FkN6M+VdNAmV/P96cFKiItkXWihw8wbSrRpxDD3AhJqYc1fWBoSLquUPR2RWDw/nua2ygGP1ma9HjrZ36lMqo+PcvdQ1PYesyYwHt4Hjl2R0XFbJ6YWf4MOdk1WPL+gSBX6xuZ+tuFFDgLgJOSXjqz4Mm8aDAgfs/UcBDYFm7MqxFlRKIOAYXVR6E5pdUpInDaA7GbnudCYdyxfB26miqRVovtzVgRdeXVF5ribabAbwGTMDKhc2Nlsgf7DVdad6ztvvAyKXc9h5HJ710VDFiAnkZdlP7SrI4oRU41GRM8goOf7A5MlC9CJSh5VaVXzgs5woGCbwev6Wb8X51C9PPqQFRmNaDNXPAETV0WaZJV3EdV42czkLeCkIvKcdOeAC2lBvulvtB/1k+KSr5CnrXEi4h2gzANvG3H3ZApgSZomrSSjnT7PMdjmpXM99LbT/EBW/uQFqdb0UQrz2Wsv2RYf0lmfdjd1197vwyQrtuDMiiAj/4TH9Q2eWh6yCOAUGHOagNJAVeWVzz6VEyBMehICVWJot9k35Ii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aWfkVVrFFP0zuhFlYZF3HxfDuhlXPHEPNSbwwAcDkXgs0PxM3KMXQTO73aQ+2nRyNvgkJQTsm4vVDsv04BmclEpa8eqGznEFoqp9KMD/2Nw4dkFFqt7BfePUPl0+gxbOVuBGRU5ILDD2VM2c4BSx7DCInTh57yJa X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(133145235818549)(236129657087228)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(2017060910064)(5005006)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(20161123558100)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR12MB1141;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR12MB1141; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQxOzQ6TmZxN1l2Sm9ycUx1M205MDJFS1MxRFhBN0dw?= =?utf-8?B?Z3VweXNLeWs3NmRhUU1HMm5pcVlKaVRreU9Hd0x2ZFlLclQ0WWloZVdxU3U0?= =?utf-8?B?VUtzTEJWYW9BdDI3QU1WRXU1bFNuMVh1UlVVeUc1SWZvRzZIQzVTL09CbXl1?= =?utf-8?B?L3F5MzRXVG03QjNRR21vQnc0bVZ6SXcxRGRpSXZ4ekFUWXJNU0I2VkJGa1pv?= =?utf-8?B?a2RGVXgrcTlraDNJc2cyM2MvaERmNVY1QkhOVWZNQWFqaEtHRlhxbks0clRD?= =?utf-8?B?dW9hUkcyT3NKUE9WL2E4ci9BUDVGWHUzcFUweFhUZ2ZoUzA5d0ZFcGNvK1l3?= =?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qejNm?= =?utf-8?B?SWV3TUwwWmtsbzJ2a3o1SEI0eXY5K2pXVlVZbkJDZDlnSVp1NVlNVC9UT3Ny?= =?utf-8?B?RlB2MzU0Tjl2ZStJVUtvNEtoQjVQdmFoZG8zYk1WSDNYMFNwSHVoR2hlSlNZ?= =?utf-8?B?a1ZTL2ZWQ1VFdlBiTGk4ZUxod0pKeGtkU1FtT1VhbkpRK3JIV1RqbWlHTlFh?= =?utf-8?B?RzYxR2hjV21yeDBNRG8wRW9zcDBhakJFZkFVNTMydkduVjJFMlVQY0hnSUFh?= =?utf-8?B?TXR1MTBJQ0RwK0lKREp6MHcxNzl6Mk9lTFhEZ1FxSWFnTnJtRGptNXd3UUt2?= =?utf-8?B?K1hlMC90WHJsVHZsSDVNZUFCekNhV1pGTkdtNDJPcjFPclJSdk92bFZqVGRQ?= =?utf-8?B?MEkvek9VZVhDdEFFMEtpTkhyZ2RCME9HM1UwNGRyZTRIU1cxNXRNWFJ1UVRx?= =?utf-8?B?S2dELysvVWJiSEIvcDdxeGxzM3hUdlBCeXBJdlVnL1FPRGNVdyttMmE3aElz?= =?utf-8?Q?HpvuzsIfMBXCbX6fvSTBiheAbFo2QePTUU4U=3D?= X-Forefront-PRVS: 0361212EA8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39840400002)(39860400002)(39450400003)(39850400002)(39400400002)(39410400002)(5660300001)(50466002)(23676002)(230700001)(305945005)(7406005)(66066001)(81166006)(7736002)(478600001)(8676002)(2906002)(47776003)(7416002)(83506001)(97746001)(53416004)(6666003)(54356999)(2950100002)(42186005)(103116003)(4326008)(6116002)(6506006)(25786009)(55016002)(1076002)(50986999)(189998001)(3846002)(54906002)(86362001)(72206003)(9686003)(33646002)(53936002)(76176999)(38730400002)(110136004)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1141;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange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9QI/sMX184qfSPiAnJKaNo9iDk3jZnYJ5wC;24:LK+Z6p7dno9TY/1DZnsOVh0AfUM1UOPUZSHOk9toQea14s5+Eqrv4oam4i1OlIqy/xiKAPuMjvpN8679FSQ1Fhwj21ZsJCUQYKMAld26zqI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;7:lg3JblfXh0umm+rRkAjx03PagUrc1anYNs6tMBdVqJNhuYYAv0NtgQZ4MDZexSX7vdcQBeRWxT/I85RfZdN80ydMbfONhZz4/a3WEKKTqjLcgwh1WAjDX2dFhOpSkQDxkQgJBRK0amR+CBctkLSXAY3IGfpqgg4JZLkn7bjCQX9CtCa68PbaY4pzYdPzapZiY/sMvX71ZL4kTa3LOR5k7TUx4exLz2eFAzU3APhL5doWtX81czTWJrLMmfkSJ4xf8FpiOkh4qEoT3e7t9hCmpn+AxyF+cNUbhlzkBJ/K4hGA8KztSRB8XUhx3TM5g47zbSflk3AsxzIXI1lvBj0oFwn9dRfgTDYxamQagflJzHebRPMejEWMk7EMPYGaLRb/362iozHOZU0cXe0zlekMKnnAziWYwa2puZL1CMxpGoyVaaCY4Ap5jzHZUB3P8mhP9tml6owVEKff0W4DhsO4SOOAR4fysExVaxWNQ1sL6jRpXWr+waiF//T/8f2l3e+a3ovblWw0uJOGR6ieS53n0JEvDkwR4q0giB6fX9+FsepowtJS7DgrLvU1KhO0xX+ex40/s5mgaUoozK+7aEUNazQZ0bMw4OgegRU9Whmhh54qUrPSPdongXMhn+4TLNB+UfXRPiK9MJNl9yFLIxzUy6381w7fgrJLQQMXS7DMTXaSJ4h584vvEtHcaQSzz6ORYXNxFtI+sFiRp2R0TgIhh/xYKbyvzGGyL2YZJUmeZV+d2YEB2Wd3uQD2UPRcWDnLf5iUp5cCcqW07s8TbRD7pIQ6RRqlHA5e4By8SZwv8xI= X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;20:i0cto2GvhGmus9qXMtysli+0+/XYLOTtUU3m3dxHCZ5kCOn5u7K2Jve/ZZl7IgP/Sn39OU0H47dkx+xis0af0/7k68DRU+APgC0lcTtYlF3d/RtSNEzVzOCLyNpfsEHTBtsKqR+bNwDsjMPx+ZYBzy1xyr4/UENL9IK97qFcDO32Zkd9BConQfv8DHcLMO2DjUSxMj2+99ktaGgOm5qZBZUV/wyvV6XW6TbRTEybGQbXhKIAwGYs8rIYOe4w7lPb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2017 13:43:24.3304 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1141 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3493 Lines: 113 Add support to check if memory encryption is active in the kernel and that it has been enabled on the AP. If memory encryption is active in the kernel but has not been enabled on the AP, then set the memory encryption bit (bit 23) of MSR_K8_SYSCFG to enable memory encryption on that AP and allow the AP to continue start up. Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/include/asm/realmode.h | 12 ++++++++++++ arch/x86/realmode/init.c | 4 ++++ arch/x86/realmode/rm/trampoline_64.S | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/arch/x86/include/asm/realmode.h b/arch/x86/include/asm/realmode.h index 230e190..90d9152 100644 --- a/arch/x86/include/asm/realmode.h +++ b/arch/x86/include/asm/realmode.h @@ -1,6 +1,15 @@ #ifndef _ARCH_X86_REALMODE_H #define _ARCH_X86_REALMODE_H +/* + * Flag bit definitions for use with the flags field of the trampoline header + * in the CONFIG_X86_64 variant. + */ +#define TH_FLAGS_SME_ACTIVE_BIT 0 +#define TH_FLAGS_SME_ACTIVE BIT(TH_FLAGS_SME_ACTIVE_BIT) + +#ifndef __ASSEMBLY__ + #include #include @@ -38,6 +47,7 @@ struct trampoline_header { u64 start; u64 efer; u32 cr4; + u32 flags; #endif }; @@ -69,4 +79,6 @@ static inline size_t real_mode_size_needed(void) void set_real_mode_mem(phys_addr_t mem, size_t size); void reserve_real_mode(void); +#endif /* __ASSEMBLY__ */ + #endif /* _ARCH_X86_REALMODE_H */ diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index d6ddc7e..1f71980 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -108,6 +108,10 @@ static void __init setup_real_mode(void) trampoline_cr4_features = &trampoline_header->cr4; *trampoline_cr4_features = mmu_cr4_features; + trampoline_header->flags = 0; + if (sme_active()) + trampoline_header->flags |= TH_FLAGS_SME_ACTIVE; + trampoline_pgd = (u64 *) __va(real_mode_header->trampoline_pgd); trampoline_pgd[0] = trampoline_pgd_entry.pgd; trampoline_pgd[511] = init_top_pgt[511].pgd; diff --git a/arch/x86/realmode/rm/trampoline_64.S b/arch/x86/realmode/rm/trampoline_64.S index dac7b20..614fd70 100644 --- a/arch/x86/realmode/rm/trampoline_64.S +++ b/arch/x86/realmode/rm/trampoline_64.S @@ -30,6 +30,7 @@ #include #include #include +#include #include "realmode.h" .text @@ -92,6 +93,28 @@ ENTRY(startup_32) movl %edx, %fs movl %edx, %gs + /* + * Check for memory encryption support. This is a safety net in + * case BIOS hasn't done the necessary step of setting the bit in + * the MSR for this AP. If SME is active and we've gotten this far + * then it is safe for us to set the MSR bit and continue. If we + * don't we'll eventually crash trying to execute encrypted + * instructions. + */ + bt $TH_FLAGS_SME_ACTIVE_BIT, pa_tr_flags + jnc .Ldone + movl $MSR_K8_SYSCFG, %ecx + rdmsr + bts $MSR_K8_SYSCFG_MEM_ENCRYPT_BIT, %eax + jc .Ldone + + /* + * Memory encryption is enabled but the SME enable bit for this + * CPU has has not been set. It is safe to set it, so do so. + */ + wrmsr +.Ldone: + movl pa_tr_cr4, %eax movl %eax, %cr4 # Enable PAE mode @@ -147,6 +170,7 @@ GLOBAL(trampoline_header) tr_start: .space 8 GLOBAL(tr_efer) .space 8 GLOBAL(tr_cr4) .space 4 + GLOBAL(tr_flags) .space 4 END(trampoline_header) #include "trampoline_common.S"