Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753209AbcDZXLX (ORCPT ); Tue, 26 Apr 2016 19:11:23 -0400 Received: from mail-bn1on0075.outbound.protection.outlook.com ([157.56.110.75]:31520 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752291AbcDZXLS (ORCPT ); Tue, 26 Apr 2016 19:11:18 -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: [RFC PATCH v1 04/18] x86: Add the Secure Memory Encryption cpu feature To: , , , , , , , , CC: Radim =?utf-8?b?S3LEjW3DocWZ?= , Arnd Bergmann , Jonathan Corbet , Matt Fleming , Joerg Roedel , "Konrad Rzeszutek Wilk" , Paolo Bonzini , "Ingo Molnar" , Borislav Petkov , "H. Peter Anvin" , Andrey Ryabinin , "Alexander Potapenko" , Thomas Gleixner , "Dmitry Vyukov" Date: Tue, 26 Apr 2016 17:56:35 -0500 Message-ID: <20160426225635.13567.39381.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20160426225553.13567.19459.stgit@tlendack-t1.amdoffice.net> References: <20160426225553.13567.19459.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: BLUPR0301CA0009.namprd03.prod.outlook.com (10.162.113.147) To CY1PR1201MB1114.namprd12.prod.outlook.com (10.169.19.18) X-MS-Office365-Filtering-Correlation-Id: 98c68810-c482-4505-ddac-08d36e26086c X-Microsoft-Exchange-Diagnostics: 1;CY1PR1201MB1114;2:UDYT5X7RrIAoimQSNAcCuFVr+7W3+YihToSmXIhdbVJWN7VIL9b4zeuPivHWsz69HDY0M2tY83KSUCbclGEgceNp35ClmjzEmkh677hqCDJf5Kn56TR/0rkd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8k11rEwijPzMdXbFyblQ8uigiPmoQGS+Lr8624nXrmOpt9uSiNlfzDx8nXVwfDwfoFxIks;4:AxVlABm1U9S00Tye/gmDuLWa4WnyWlXVzWvdgz2j5lp6WsSVmsiEZPxfPShCAxsJ+yOMeFwoBPDWeB7O025L2zyEs5hCBKEBhNwzDVbxhOOwz1184ulqTFck3K4pEZVT1Lw/n6MdN5pF5gFsbRBzU8/zYMps9f8NEpWc9W824f+OHXpTPFgH+W+h4g9LdtoQuQEofAZxACZNtFmz58IldcgjgMRV2fDB9jDEFgNMvesD2TGv70OSMTZOnCx+KKgi0lvLGaOSLVHJJGZjGEGfuiXpxd/PIMb06h3imJQSvOeMYsTxthS1pZZL2bCJVRWsxw/Hyesz5gLUgDLWyMd9F9moZ6e1sqUOCHw5kCiwhhNS7xnwjD5+0qwQJjSK1hLGafjF2XkPNjStLCe0JPm993XpTy7H706zm8iUb0OU1qI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026);SRVR:CY1PR1201MB1114;BCL:0;PCL:0;RULEID:;SRVR:CY1PR1201MB1114; X-Forefront-PRVS: 0924C6A0D5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(2201001)(92566002)(2906002)(5001770100001)(97746001)(81166005)(33646002)(66066001)(230700001)(4001350100001)(47776003)(54356999)(50986999)(50466002)(23676002)(76176999)(86362001)(229853001)(9686002)(5008740100001)(189998001)(53416004)(4326007)(6116002)(1096002)(103116003)(42186005)(1076002)(5004730100002)(19580405001)(77096005)(2950100001)(19580395003)(586003)(71626007)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR1201MB1114;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjE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ImA0cuzM7T91ykh8Wn0B8XejgwyA/aiHeGo=;20:/+MHMWNpdfA186lMIFwnmkZJt5oYLm7Mrf3IKADV+gCC3fa2HLTvQFGp8mgGRVhRp6ZrI64WDI4WHPT3WgqVURVBlZnTyN5m+fBZzBPQaZT/VBP6Rb4LsFmvADOqviLrsHkYn1YlU3hnF1CmciD4+IGRw4kNkEMKj+VnqIelW/5I32F3O15DnZ6UrYoIocNRLjnf9WDBMANMvtOSAMxli0PH6a7tnMSurlfD83G0GlZFDsD6cHV3ILGm5NXXStAF X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2016 22:56:39.4786 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR1201MB1114 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1965 Lines: 57 Update the cpu features to include identifying and reporting on the Secure Memory Encryption feature. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/cpufeature.h | 1 + arch/x86/include/asm/cpufeatures.h | 5 ++++- arch/x86/kernel/cpu/scattered.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 07c942d..e27e352 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -27,6 +27,7 @@ enum cpuid_leafs CPUID_6_EAX, CPUID_8000_000A_EDX, CPUID_7_ECX, + CPUID_8000_001F_EAX, }; #ifdef CONFIG_X86_FEATURE_NAMES diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 47b5056..4aea205 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -12,7 +12,7 @@ /* * Defines x86 CPU feature bits */ -#define NCAPINTS 17 /* N 32-bit words worth of info */ +#define NCAPINTS 18 /* N 32-bit words worth of info */ #define NBUGINTS 1 /* N 32-bit bug flags */ /* @@ -282,6 +282,9 @@ #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ +/* AMD SME Feature Identification, CPUID level 0x8000001f (eax), word 17 */ +#define X86_FEATURE_SME (17*32+ 0) /* Secure Memory Encryption support */ + /* * BUG word(s) */ diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index 8cb57df..d86d9a5 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -37,6 +37,7 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c) { X86_FEATURE_HW_PSTATE, CR_EDX, 7, 0x80000007, 0 }, { X86_FEATURE_CPB, CR_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CR_EDX,11, 0x80000007, 0 }, + { X86_FEATURE_SME, CR_EAX, 0, 0x8000001f, 0 }, { 0, 0, 0, 0, 0 } };