From patchwork Tue Jun 27 15:08:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 9812351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A0D460351 for ; Tue, 27 Jun 2017 15:09:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C8EB28589 for ; Tue, 27 Jun 2017 15:09:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 609D6286BE; Tue, 27 Jun 2017 15:09:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC0BC28589 for ; Tue, 27 Jun 2017 15:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753205AbdF0PJH (ORCPT ); Tue, 27 Jun 2017 11:09:07 -0400 Received: from mail-co1nam03on0068.outbound.protection.outlook.com ([104.47.40.68]:12832 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752744AbdF0PIS (ORCPT ); Tue, 27 Jun 2017 11:08:18 -0400 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=VHy+Y8BitjrRFTCAcadyvuQHCoypAH8lFEvxE9blC+c=; b=KBySq0uCWSju9XyRirHVo6b3LWZWnbEfw3UgWZQ/CIHhClWSnDyd6eGYnhDyoag/+N0pDlf9KSZHdCtaA+9t5719lc1q0i9v52oxuXTBIC0iqUKw1A7clshfCtbxtHwQB6X0jpM5kh7mtD2VkLWoUhPCMsqDwG05Bvr1gp2qXDY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from tlendack-t1.amdoffice.net (165.204.78.1) by BN6PR12MB1139.namprd12.prod.outlook.com (10.168.226.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1199.15; Tue, 27 Jun 2017 15:08:06 +0000 From: Tom Lendacky Subject: [PATCH v8 RESEND 04/38] x86/CPU/AMD: Add the Secure Memory Encryption CPU feature 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: Tue, 27 Jun 2017 10:08:02 -0500 Message-ID: <20170627150802.17428.331.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20170627150718.17428.81813.stgit@tlendack-t1.amdoffice.net> References: <20170627150718.17428.81813.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR03CA0048.namprd03.prod.outlook.com (10.175.124.34) To BN6PR12MB1139.namprd12.prod.outlook.com (10.168.226.141) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 849b5259-4f56-4c7a-6247-08d4bd6e5174 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); SRVR:BN6PR12MB1139; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1139; 3:jbQlasXi066cW518QClt27HZ+5czjawg5j+DD8pGh/updr195N2FJmG1BIG+5gXyoOSAMxh4woKiZNtIIoMZhQtj4MR2Ihz7Vj8WFk4Cfll0bPsRJnDgM2Y65gTCnwlU1/7xA27YagLOyuND2FcAozOZhBFtvuCRC2F3n0eXjtelc2Ayp7V/TV2j1LSvExCFdp2q3oL2DzkSVotMYffyLvUH9sr91NePmo3ej0WIZAPc2o6eIivbf1AmcZI+iGG6Q+eJG52vCxq44wh6hnagxdxoECrkY9LB7x3nUoQ4O3oXrlfScq37Vi47Qbo9gO4wp6fD0cjEldSg6qX3qd1j5aboxtcnL6bDUaUu2EbHkxP6Ro+KyN5yLzS2tZsVQ1jws7HWu5RME35UMK0TpDTRCimrhTbbufezYMZZ06VL8+YFl++Gm5P9+HY3TAhROkAWGJ7dCHRxUy6znjxS1+Oirf+743HhAiPkd48K8oFRs5MyP0FbphX1RWmMS0I8BGqOoSxuW8F0vSnPjelO+MNzdAgrqxETY0Fh03XSpzo3UC9sA3zNGqtFFWGXyY4r8oumlVn74YFrcBqhnKdvZz7baK/CJyLzHbXb66Sr95aSBSCvstrENZwD1U4xtbIXasxVtqa2g+SYCnpKeVNQTfo6G080JCNRMtXX0EIolqRUA4TD+9Ejo5D8yl5m+1SPC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OMdQUsnb8dIrsWswW1UZCPzG67uphIkwmMKT0cLzLQWsYdquMLe6rHBz6IvvG8wrrrYHID5iSIjjoLcB1AaKoG3d9GyOq81qtfhhwyWpW91axfdTiWvmE03zSN01TMIxFhjMORe1fk12SJHWzynUq7rUeTKhK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(125551606395959)(133145235818549)(236129657087228)(767451399110)(167848164394848)(211171220733660); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123558100)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR12MB1139; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR12MB1139; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMTM5OzQ6NTVXQXFmdVRjNU1lNGQ1U0t4L1ZxNWVwcm0r?= =?utf-8?B?YkZtaUROeHZDcjBFZGlpTkl4aGcxYkVFUkRnQVAvWk9Nb1ZRdFlSWWxkcUNv?= =?utf-8?B?Tjl0S1ptN28yZDlIaEdMQ3pwOUtiN01jUVRNdHlKdWxNUFpGTTE1SG9kQjVC?= =?utf-8?B?K1d1WWpINkZOV3pnNTNiVE0zVG5WaEw2dWcxajZOYzlndzlGSE1rS1ZkeTl4?= =?utf-8?B?dHRTdXFiYmN4Z0RwcDJFSFZBU0ptNnlKY2lMbU1aeHVMaS9Mc2tpd1JUc2ta?= =?utf-8?B?VUN4MXZ4TlhlbDVJV3h0VDJQelJHY2JJQ1FDWGtUMWNPS0kxYUFmb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wVncrUkYxMWh6Ti96ZUdlS1d0?= =?utf-8?B?YlY2aXhnTjd0eWNMbnc3NlhjaUR3V2pzaXh1QW5STzRjc21oc0F6L2MydWR1?= =?utf-8?B?ZDhHME9yMS9IbGtmSGFxVzRaZHE2WlB2TkRmSmd3OGJ3bEREeGxBRTYzRmNq?= =?utf-8?B?RU9XNGpjT3ZDRmQ4ZWcyRTZwSEIyaDZDU2w3ZlV2bTEyWWtDNUVqWm90LzRx?= =?utf-8?B?WXJGUnlJZUwweDkzbm9MakNZck5UL2J3UlZtaWNTbEJ5VDJJL2YwN2Y3ZmNL?= =?utf-8?B?N2hLb29hU0h1UDRaeG4waDhhSDJuQnVDYU1ML1psUzlXZFJRMWFjbmxsN1hp?= =?utf-8?B?THl3Z3hlUzJBbzkxcEZvV0ZZWVhsV05GVEZMM21rQ2xZbWU1ejJqc2lpZCti?= =?utf-8?B?aFA5NUZXaXYyNHpMbFZTQndmbk1CUjFlYXcxM3NrdWNBU1d3eEQ2OEFHMlFj?= =?utf-8?B?YWFJSDN5ZHN3MTQwOEpUZnhWaXYyZ1RXN0hvZDhsSUM0ME9XeStSd0FEcjVo?= =?utf-8?B?Mk1OZWpaaVJWbTBIY3lFNU93T3RWaVIwZGVuOHIvTmtrNmtCbHBQczZhQ0lL?= =?utf-8?B?dEkrOUxibElEbjRhMkdHT0YreENPTUd6S3dFZUNLa1NIZkt4L1J3MDM3dk14?= =?utf-8?Q?xH5hJektpo=3D?= X-Forefront-PRVS: 0351D213B3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39860400002)(39410400002)(39840400002)(39400400002)(39850400002)(39450400003)(2950100002)(6666003)(4326008)(81166006)(7416002)(7406005)(6506006)(1076002)(25786009)(6116002)(2906002)(3846002)(55016002)(54906002)(9686003)(53936002)(5660300001)(86362001)(76176999)(53416004)(72206003)(54356999)(230700001)(47776003)(189998001)(50986999)(110136004)(50466002)(7736002)(66066001)(103116003)(83506001)(8676002)(23676002)(4001350100001)(478600001)(42186005)(33646002)(38730400002)(97746001)(305945005)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1139; H:tlendack-t1.amdoffice.net; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMTM5OzIzOlh3ZE50VlNYSGxnekhWbHg5eW9LU0xENDBy?= =?utf-8?B?YjFuZi9Rd0o0eUdJYm1LUWpCcE1wVkZoRUVPSkc5azQzcFAxa3ZRK29uQ3p1?= =?utf-8?B?L09kcWk1cktpaGxETzZuZXpPY2ZkcjZuNXVjZEhHUFoxRURHTFZPaVZmSjh4?= =?utf-8?B?WFl0d3M2cmVQY3RxK210Qk1FSHMwdGJVVXJGRTVPbVZCZU9HQ3ZBZElsY1Yv?= =?utf-8?B?ZGpZRVE5ZGVnSUJjRHg0NWdMN1pReWp3M3Axek5BUytZcjRZWWpwUVgxc1BP?= =?utf-8?B?Nm1ySTFsOVhibzdML1JuejY5Wk1hOEZOS2NXMXlxanRKU2twU1dHTllJRVQz?= =?utf-8?B?Kzl1ei91U2dHdU9QNmhUKzRlMHZTWE01MXFYbXcrb1BxNEJqQmdPMFhVYTdx?= =?utf-8?B?ckRLSHc5Wk5GNkUrV01JdDFnVm90bkVqcVpiSFlWSytGbENsNUtjWFJwb05x?= =?utf-8?B?TTg3NW5NanorMldkRWE4cTBKY3lPVzVjdzZTbytVaVRiUW8rNGIxUGFwNkND?= =?utf-8?B?R3lXaTZydS9iWHNVM290YjJNMUFyNmJtekRMNW8ycllORU5rcWVBUEM0Y0xx?= =?utf-8?B?alBVaGVaVDNNbXhyVExzbzdJSGwxb3BhY3F0YUR3S1kwd3M4c1RJb25EK0dI?= =?utf-8?B?K2xsTVhtV1hpTVdSU3V6OG8vbXVacm9oSldDNnVxd2JpWnptb0dtU0k0VU95?= =?utf-8?B?ZGxMVVdieFhSZ1kyaVNhYXhyL3dScm8yeFA3VmZsV1JRaX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Oq47qE98uw2EFoTnKA80GFkwb0BJKUhlrYhty+bs0JjjH8Kb7eABTLt8KNOU0rAia+iXWTtL/rcb93k6JHcPsGsZ77xwueukjG0AuCFLUaA2L+mPQVNVS7k= X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1139; 20:dnrRqiXbkwwkvhucK/XPttCBJAbLDnb+MdAl0HFBl6GWZwyuI7uo7YJmbqH5Dslcm5L/i69TSyPE8nIxUh4gcOhlG/NFqfpOSNZF3wFEJFVxf13Vli9xhd1vCHqX8ZG7YNBBIsQ0FInoUgntgynbsr+J1LqkI8UqQ2nmTPEf2i/yqxqjpXP56q4t4WPLBKKwMFhvgHUHxZnC+CNpBvoqDfyf+gYJgOOXKj7sG9WfMt3sCU2f5IWPnpDVTnT2HLp/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2017 15:08:06.0622 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1139 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Update the CPU features to include identifying and reporting on the Secure Memory Encryption (SME) feature. SME is identified by CPUID 0x8000001f, but requires BIOS support to enable it (set bit 23 of MSR_K8_SYSCFG). Only show the SME feature as available if reported by CPUID and enabled by BIOS. Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/msr-index.h | 2 ++ arch/x86/kernel/cpu/amd.c | 13 +++++++++++++ arch/x86/kernel/cpu/scattered.c | 1 + 4 files changed, 17 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 2701e5f..2b692df 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -196,6 +196,7 @@ #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ +#define X86_FEATURE_SME ( 7*32+10) /* AMD Secure Memory Encryption */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ #define X86_FEATURE_INTEL_PT ( 7*32+15) /* Intel Processor Trace */ diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 18b1623..460ac01 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -352,6 +352,8 @@ #define MSR_K8_TOP_MEM1 0xc001001a #define MSR_K8_TOP_MEM2 0xc001001d #define MSR_K8_SYSCFG 0xc0010010 +#define MSR_K8_SYSCFG_MEM_ENCRYPT_BIT 23 +#define MSR_K8_SYSCFG_MEM_ENCRYPT BIT_ULL(MSR_K8_SYSCFG_MEM_ENCRYPT_BIT) #define MSR_K8_INT_PENDING_MSG 0xc0010055 /* C1E active bits in int pending message */ #define K8_INTP_C1E_ACTIVE_MASK 0x18000000 diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index bb5abe8..c47ceee 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -611,6 +611,19 @@ 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. If BIOS has not enabled SME + * then don't advertise the feature (set in scattered.c) + */ + 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)) + clear_cpu_cap(c, X86_FEATURE_SME); + } } static void init_amd_k8(struct cpuinfo_x86 *c) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 23c2350..05459ad 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -31,6 +31,7 @@ struct cpuid_bit { { X86_FEATURE_HW_PSTATE, CPUID_EDX, 7, 0x80000007, 0 }, { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, + { X86_FEATURE_SME, CPUID_EAX, 0, 0x8000001f, 0 }, { 0, 0, 0, 0, 0 } };