Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752251AbdGYO37 (ORCPT ); Tue, 25 Jul 2017 10:29:59 -0400 Received: from mail-by2nam01on0056.outbound.protection.outlook.com ([104.47.34.56]:58328 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751872AbdGYO3z (ORCPT ); Tue, 25 Jul 2017 10:29:55 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Subject: Re: [RFC Part1 PATCH v3 02/17] x86/CPU/AMD: Add the Secure Encrypted Virtualization CPU feature To: Borislav Petkov , Brijesh Singh Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-efi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andy Lutomirski , Tony Luck , Piotr Luc , Fenghua Yu , Lu Baolu , Reza Arbab , David Howells , Matt Fleming , "Kirill A . Shutemov" , Laura Abbott , Ard Biesheuvel , Andrew Morton , Eric Biederman , Benjamin Herrenschmidt , Paul Mackerras , Konrad Rzeszutek Wilk , Jonathan Corbet , Dave Airlie , Kees Cook , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Arnd Bergmann , Tejun Heo , Christoph Lameter References: <20170724190757.11278-1-brijesh.singh@amd.com> <20170724190757.11278-3-brijesh.singh@amd.com> <20170725102657.GD21822@nazgul.tnic> From: Tom Lendacky Message-ID: <7236d267-ebcb-8b45-b8d3-5955903e395f@amd.com> Date: Tue, 25 Jul 2017 09:29:40 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170725102657.GD21822@nazgul.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CO2PR05CA0004.namprd05.prod.outlook.com (10.166.88.142) To DM5PR12MB1147.namprd12.prod.outlook.com (10.168.236.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fadd1162-bf86-4281-fb0b-08d4d3699ab0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM5PR12MB1147; X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1147;3:znhJU9ZkgShmi+bkaLqXkSX4tp1ZCNjKnCTIFqaTC58kIf0h2AEU1ymtDkcqDAmPM1yBmdAqmzpW6xETm9tna2ZB+LUXBz9/mKVYa4PYAwPmOHML1ZqcDMN3hLNHiC1V6ts0Ko9jzCYqROBcU7eG2K3YaSmuytf55UMnA4NVZvV7WPFg4Gp1uRuU7ditdtyKDvygu3VXnoyWsR0PFZ6ELt+G6AnR6A0Qk7Cfph1tWyrSzE7MmArqwtTwsUCRJj4WnUmYJn63y4kNk+lHmwY9ZwO96ixqzoe+GUweBB+sm4LwuHx7CvAzVIqYqJVXbD184cTmP9gOlSGG84/UDK4P3NJeze+KKma4u4Nm+b0k1jSm0Sxlyu/cUYC8WT+u8JE1dqT1YQkX6QTh29qbPZlcmW6o7bClG2+GStunwaNQ90qlmDkIig4yBtP7Y8iihMdgNS04dld3fdgLXnu0MY+cKR6HDzd3MOljDOG0bC1XLyVgwUoMC41mM/I2FUNiAZK9DCO0ZPIuPJQpVNIFaEQYEoF2F4aEDeXxVkk7z6rnSG5N31tpkazykHiWD8nzhVd4br/BeZAS4eJQA/i3Su0zjQe16pUwKM2FsB8dERzRPixvpI/VpVErJnBOhUBerYGbA3T7bMHtuLibgN7xzIj6s+HLnUP03OP+iNmAwmKyzj4h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9F4rxCv5lsRKskFOYwuaLAWgw7S67rkkTtlZy5POG7y6ZmfCJKK8EuDVQw74De/amnTeDnwjIJc4dsN57oAfxTRkS4njp2Hy4O3Fzj2YMgj5kjtfoAYQPLHNVupQkCi/eRFfNrwC69KZO+ebhkbouEJu4aRBKiICyYFE+77ZRTXOYu0sJ3JuqVQFL5NQm08XLkd23da8SJYsrLOqI4g0dllVVBcUyEFtEDJEoq X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(211171220733660); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR12MB1147;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR12MB1147; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMTQ3OzQ6b3pmbkJQTFVxREtrWjlybUZObDBBUnVoN0ps?= =?utf-8?B?Q2JZOHd6amlHL001ZHdkNERKMFhYamh5U1gvc2RVK2Q3TGMwd0g0VEMyZHZm?= =?utf-8?B?c0hMeGduNU5xN2RXRlhwZnBQSEkyRkg1eWxUWmswZU40dWtjaDRYWU4yZ0FL?= =?utf-8?B?bWFTVGNLbzRzdUFKK0VIMXpWSXpHYkdQbHF6U3ZGOEJqTXZOTTIyWVJ5Yjcy?= =?utf-8?B?aU93V3VHbnZRWldHWTFWOWNKNW1rdTBSUmY4Q2drYUI0ZUZvZityZ0Y0VnlK?= =?utf-8?B?SjRidFV2VDBFdjFFc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VBTFdHdXAxK0E3VTV4K2xrcUhvMjNYMmdqTElqV1FTaXFUeGt3?= =?utf-8?B?ZHB4aUxzQy9vbEFnMThFN1M4OGE2ZDJRbjduUFZKYTc4VXM1Z0tDbldVc1Fy?= =?utf-8?B?NDBXZkpsRmptK2NlQVZWQkt4N0dBajFnbzlyYmJYT2wrMDlCbVVNK1VHTytM?= =?utf-8?B?Vk5BOTVXb1dqVkp3WVhwWlYxUE1JVFRtU1RZM3RzRHZSTU5VdzVsTHJBS1Yw?= =?utf-8?B?VGVnSFN6YTlLSXNhcW5jRVZXdXcwc1dkeVJobVBuekVtQ1Q3SFIrTUpEZU96?= =?utf-8?B?MW9SZHpzbjFSTWo3VUc4dEtwT01SVGxUdm4xQy93azlmZWx1aGxKc2V4SG4v?= =?utf-8?B?U0V6WjY4bjVzV256aVdUUE5yOVhLbnpiK1crbVpvaC9IeEFuMitnQ3lyMVZn?= =?utf-8?B?QjhsWm9kWTZWN2QzUUUvdjhibXMzcFRySzRhMEFFc0VCS3RXNk05UHhsRFB4?= =?utf-8?Q?anConBjS1YQMkyVlM=3D?= X-Forefront-PRVS: 03793408BA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6049001)(6009001)(39450400003)(39400400002)(39410400002)(39840400002)(39850400002)(39860400002)(24454002)(199003)(377454003)(189002)(23676002)(229853002)(65826007)(7416002)(7736002)(305945005)(50466002)(86362001)(8676002)(31696002)(2950100002)(47776003)(230700001)(33646002)(7406005)(6636002)(5660300001)(97736004)(68736007)(189998001)(65806001)(4001350100001)(65956001)(66066001)(83506001)(478600001)(72206003)(6666003)(36756003)(42186005)(53546010)(4326008)(6486002)(90366009)(77096006)(7350300001)(76176999)(106356001)(54906002)(54356999)(81166006)(6246003)(38730400002)(101416001)(25786009)(53936002)(3846002)(31686004)(64126003)(81156014)(50986999)(6116002)(2906002)(3260700006)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1147;H:[10.236.64.250];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IV5/d084SsyIyXINYmVmQOrYs4VpMomUT6GnHSPjjFr0N5Bud21GABpmXJFhvzSPboVs9+bH+qudkWU5WH6yn+WtlsLkgv/BZBs3/s0d7T3r97OmuPtl+tVHEuWH3fKDB4Bi8+zAeLRNX1/GpIlDfg5F9909t1jbc/DQOCRIfL2w6pX4e29Cy0MB7++xgwfbBiBPTPwK/H6Ureho00chmTQQFYQ5vIQlpzr+7ycR5uVFPup0bePUyDLH6p+wNGpvZE1gfoID3EpTWiRLkjI/H3cYKpcPw82A82SExC0dNIsUGN0ZSvlu2p5YlKqW0ODBGmvaEqnmIWcuR855wFrFVDyGoW3NXlnLawRF8TZ93lxoiAUHbdHIBGC6qYxNVxa3PPJ7wpBUpW4S8JSpWF3gwdCZiw6XRVsj8KvcStyKkdLfubTgWMP8P1On2DFh85j96C3fmtZxUa1APtMHHnsr0n/S0cB0IZZ3kTAcgADWdyBJwq60LJFUfxGC26bEsRs/md6sg+uMFfWKqpuP4GNNGh8oCmzwmeybUssP0FC5S4HmORIoWHeopbHxSvSshj+Zzb84AR9iJjHInh1NAYJPCg6jhzjNnp4/byFF5iGHch7iDG9USkYAAaGH5pHbTo+kb7wsdxVHG1T+FMglRI+jgudSAZZI= X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1147;20:MLINpcTskY2FiXgzvdUgXkM82S2rJKzHOfbWRZB7peyIQpGDYuOekp34+c16+lRAaepwzAR6SWixgNHqZo9XfgrQUxQPEHFL9jL7CJY1vhI0SqTZztiBpyQ7o6eBzvaTII503el3ruSLXruDqq2SnHWa0yTnAg1cjISp7hZb/VZAeJNlMH68ZorXYrWIC4LhEmknk41pNLNKty3mmzSkHEfTeedtH38cs/ssKgAcU6/4tm84lzdLVWuV0J1UYZc7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2017 14:29:44.7336 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1147 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5050 Lines: 155 On 7/25/2017 5:26 AM, Borislav Petkov wrote: > On Mon, Jul 24, 2017 at 02:07:42PM -0500, Brijesh Singh wrote: >> From: Tom Lendacky >> >> Update the CPU features to include identifying and reporting on the >> Secure Encrypted Virtualization (SEV) feature. SME is identified by >> CPUID 0x8000001f, but requires BIOS support to enable it (set bit 23 of >> MSR_K8_SYSCFG and set bit 0 of MSR_K7_HWCR). Only show the SEV feature >> as available if reported by CPUID and enabled by BIOS. >> >> Signed-off-by: Tom Lendacky >> Signed-off-by: Brijesh Singh >> --- >> arch/x86/include/asm/cpufeatures.h | 1 + >> arch/x86/include/asm/msr-index.h | 2 ++ >> arch/x86/kernel/cpu/amd.c | 30 +++++++++++++++++++++++++----- >> arch/x86/kernel/cpu/scattered.c | 1 + >> 4 files changed, 29 insertions(+), 5 deletions(-) > > ... > >> @@ -637,6 +642,21 @@ static void early_init_amd(struct cpuinfo_x86 *c) >> clear_cpu_cap(c, X86_FEATURE_SME); >> } >> } >> + >> + if (cpu_has(c, X86_FEATURE_SEV)) { >> + if (IS_ENABLED(CONFIG_X86_32)) { >> + clear_cpu_cap(c, X86_FEATURE_SEV); >> + } else { >> + u64 syscfg, hwcr; >> + >> + /* Check if SEV is enabled */ >> + rdmsrl(MSR_K8_SYSCFG, syscfg); >> + rdmsrl(MSR_K7_HWCR, hwcr); >> + if (!(syscfg & MSR_K8_SYSCFG_MEM_ENCRYPT) || >> + !(hwcr & MSR_K7_HWCR_SMMLOCK)) >> + clear_cpu_cap(c, X86_FEATURE_SEV); >> + } >> + } > > Let's simplify this and read the MSRs only once. Diff ontop. Please > check if I'm missing a case: Yup, we can do something like that. I believe the only change that would be needed to your patch would be to move the IS_ENABLED() check to after the physical address space reduction check. Thanks, Tom > > --- > diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c > index c413f04bdd41..79af07731ab1 100644 > --- a/arch/x86/kernel/cpu/amd.c > +++ b/arch/x86/kernel/cpu/amd.c > @@ -546,6 +546,48 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) > } > } > > +static void early_detect_mem_enc(struct cpuinfo_x86 *c) > +{ > + u64 syscfg, hwcr; > + > + /* > + * BIOS support is required for SME and SEV. > + * For SME: If BIOS has enabled SME then adjust x86_phys_bits by > + * the SME physical address space reduction value. > + * If BIOS has not enabled SME then don't advertise the > + * SME feature (set in scattered.c). > + * For SEV: If BIOS has not enabled SEV then don't advertise the > + * SEV feature (set in scattered.c). > + * > + * In all cases, since support for SME and SEV requires long mode, > + * don't advertise the feature under CONFIG_X86_32. > + */ > + if (cpu_has(c, X86_FEATURE_SME) || > + cpu_has(c, X86_FEATURE_SEV)) { > + > + if (IS_ENABLED(CONFIG_X86_32)) > + goto clear; > + > + /* Check if SME is enabled */ > + rdmsrl(MSR_K8_SYSCFG, syscfg); > + if (!(syscfg & MSR_K8_SYSCFG_MEM_ENCRYPT)) > + goto clear; > + > + c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f; > + > + /* Check if SEV is enabled */ > + rdmsrl(MSR_K7_HWCR, hwcr); > + if (!(hwcr & MSR_K7_HWCR_SMMLOCK)) > + goto clear_sev; > + > + return; > +clear: > + clear_cpu_cap(c, X86_FEATURE_SME); > +clear_sev: > + clear_cpu_cap(c, X86_FEATURE_SEV); > + } > +} > + > static void early_init_amd(struct cpuinfo_x86 *c) > { > u32 dummy; > @@ -617,46 +659,8 @@ static void early_init_amd(struct cpuinfo_x86 *c) > if (cpu_has_amd_erratum(c, amd_erratum_400)) > set_cpu_bug(c, X86_BUG_AMD_E400); > > - /* > - * BIOS support is required for SME and SEV. > - * For SME: If BIOS has enabled SME then adjust x86_phys_bits by > - * the SME physical address space reduction value. > - * If BIOS has not enabled SME then don't advertise the > - * SME feature (set in scattered.c). > - * For SEV: If BIOS has not enabled SEV then don't advertise the > - * SEV feature (set in scattered.c). > - * > - * In all cases, since support for SME and SEV requires long mode, > - * don't advertise the feature under CONFIG_X86_32. > - */ > - if (cpu_has(c, X86_FEATURE_SME)) { > - u64 msr; > - > - /* Check if SME is enabled */ > - rdmsrl(MSR_K8_SYSCFG, msr); > - if (msr & MSR_K8_SYSCFG_MEM_ENCRYPT) { > - c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f; > - if (IS_ENABLED(CONFIG_X86_32)) > - clear_cpu_cap(c, X86_FEATURE_SME); > - } else { > - clear_cpu_cap(c, X86_FEATURE_SME); > - } > - } > + early_detect_mem_enc(c); > > - if (cpu_has(c, X86_FEATURE_SEV)) { > - if (IS_ENABLED(CONFIG_X86_32)) { > - clear_cpu_cap(c, X86_FEATURE_SEV); > - } else { > - u64 syscfg, hwcr; > - > - /* Check if SEV is enabled */ > - rdmsrl(MSR_K8_SYSCFG, syscfg); > - rdmsrl(MSR_K7_HWCR, hwcr); > - if (!(syscfg & MSR_K8_SYSCFG_MEM_ENCRYPT) || > - !(hwcr & MSR_K7_HWCR_SMMLOCK)) > - clear_cpu_cap(c, X86_FEATURE_SEV); > - } > - } > } > > static void init_amd_k8(struct cpuinfo_x86 *c) >