Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756149AbdGXTJH (ORCPT ); Mon, 24 Jul 2017 15:09:07 -0400 Received: from mail-bn3nam01on0045.outbound.protection.outlook.com ([104.47.33.45]:41632 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756081AbdGXTIe (ORCPT ); Mon, 24 Jul 2017 15:08:34 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-efi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Borislav Petkov , Andy Lutomirski , Tony Luck , Piotr Luc , Tom Lendacky , 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?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Arnd Bergmann , Tejun Heo , Christoph Lameter , Brijesh Singh Subject: [RFC Part1 PATCH v3 03/17] x86/mm: Secure Encrypted Virtualization (SEV) support Date: Mon, 24 Jul 2017 14:07:43 -0500 Message-Id: <20170724190757.11278-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170724190757.11278-1-brijesh.singh@amd.com> References: <20170724190757.11278-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CY4PR04CA0049.namprd04.prod.outlook.com (10.171.243.142) To CY1PR12MB0150.namprd12.prod.outlook.com (10.161.173.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 02a131e8-7fa6-465d-94d2-08d4d2c7597f 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:CY1PR12MB0150; X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;3:MxvuZlfjzWVQI6le1AZfm9EkzZyoqyNjGr8tYq7OfdQ9EnD0veae9XlGn104OJXwJLHAbzvMdrzTRqw6tWebfwANLTlawNk2/H51mmv//XD6dE5pZJ1pZJkKm0OFAREiYr9khw7tBfRmRJ7NzT3BrRwX6Z8zRB02fBYf14oCAo8ekEnk8fpClbWOIHVVRO92ixq+stv8xAXHM0hHxj0KkvN0FIilzphTL4BrrlbfjoLl06gUindq8AIwqx7SQ2U/kpwmbKIFMTF5gNE/t0Q4jYOm0ySKAe5fYgnPnBkzKjAJWiIBJsS1PWJLU4S017b7AHrFdnIfZwva+Z2qrxBrYgZ5WYdvdO9erJucGEln8h3BMs9AWh+b5cOi5bj5O8/mJujIjL6KIECpHK9skNEasDKtQBgr9Sm+VE6wd1uSaklHXL+xVYPgFRHnDj6YIlbP4EThGZzBXkZ5l9Qx3ohiw/T/L48YAXX3CPcFYabkayOWb7I4+Gnn1g6ilH0x41ll9FFOGUL8UKxZJSiAyLw62fuEuSogVtf06704ax4wXHzcWAloT/rdnI32iKp3IPgQ2ofDncFS7j7xSUwc6Kwp+FCurjqRKh2Uw34AaAHCiuYYzgKnWQr6pschGrMu5yqq3XzT6/hwzbb4EhdAaoefPYkT0AWnd9qI3k4LmiJLpbEh2Z8WHZ9+u0Y3lXXC59foWheea31XMnWwp9BrD+HalwEnGQtITys4OWvdYIPeSJYjDzFlNqb0SiSBC44he7mlwD573kZq0jV1xgqstu25AQ== X-MS-TrafficTypeDiagnostic: CY1PR12MB0150: X-Microsoft-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hnV8JoGUTHE7PuAi38qJaDeLXiBfpwdSQmLW/t8YcjqlhbXi5kKvnfiovvMtXZD8X6Ehi43S/Ejz7aVL+ X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR12MB0150;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR12MB0150; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR12MB0150;4:OYitBSEZD7+n1XXI3XeAlYzCI52+BlJf0YEAqtk04N?= =?us-ascii?Q?drcqc2wfD07oHQ/rqPEYcaKBfqSnQ27kl4fidmQQVTGzH3JHwLGA+7rONtX3?= =?us-ascii?Q?gpvzJ4TqH+X2oOCQnbBpl62dKgO9dIN+DtPIqICMLS71fswyB57y+o8HTTvo?= =?us-ascii?Q?uOlKonAxfQKdaW2ZU4IOvu3t17eDsig2UUAKQHcFgvwq4nQ+g22oQ5Hj6VXh?= =?us-ascii?Q?QUuMs4fuhzbFHF87hLnKz18NoPp/2SF0CU5kidWhnkNoVnMkJzgfWH65/b15?= =?us-ascii?Q?w8Ug/Hh1COMR1j1L6zJTN1hWc0duPYpr5CXLgXZCKKFynfk10QhdW5bd9HTv?= =?us-ascii?Q?C4pT1df6W/3ToGBIT7rnm+2QVtd3avaLrBBDM2gxIvoCEYjpOqF5PEIkkcjb?= =?us-ascii?Q?3oEpWwjNZ9PpJrBB6lElu7muIgbRi4Q4XMFpWhoNLu7sn81r0pQ52HfAwM3b?= =?us-ascii?Q?7subExW9XmtG9RQMIYLjK1vsgMOdMFBgMWqwLbgfOj+a8eYsdQ1Qoi8DOHVb?= =?us-ascii?Q?m3IzT30c1ncg5XtVSmIXTvAD0ncJCSLVdvPM7gt4iO+D480uTqiqN0kgN8vl?= =?us-ascii?Q?YTUQs0fTRIS4A02+dLRjw0EPYlD2Ihwgnun/1ib87omygPmBndixBzObDDlV?= =?us-ascii?Q?KTqL3YK974JltZwztFd8KyiOVdjNE+8fEwoxBKOmfzosH1MmKxjgay4wNBoK?= =?us-ascii?Q?qoTLxpZW38mLkf23/qWtHLWBpdRUzlFdRVvaVli2bBZL9AJkfbDabB8SNco+?= =?us-ascii?Q?ivVngioLEq73ajAC5W1NiSs4Jsx4F+CvN3e9+fmRnKExoxZaIQbiEJToAZZD?= =?us-ascii?Q?j5yebfSVye4B1PrDU6Bhl3fzN5E8bXtMAmeqIp39e9Up4it/chN3ePJR/HNi?= =?us-ascii?Q?i+dP9R9wgZZPlcIJaz2SdSb1xF6DVzTntBoUWFeThFTHK7EngwKndt9E/61J?= =?us-ascii?Q?5Pwdlu1V6QZCJ1BuqrVSc36LbdSitd8SZ8tf6bexbTlXsRYE+Wx/ceb5a36M?= =?us-ascii?Q?7UIFHnx9Az2uBYu18uNF/hV1eX58DAKQBkW60qE1yrCk59t6OL4ybuVHf9dr?= =?us-ascii?Q?+v6+M6XyBYvdPPUPCX595/Z+S6t2cap6Io1d3Pk5RUT0KTSLxcx8XVJg+Jm8?= =?us-ascii?Q?zQU5hsaQ2ygdZyAGr1XbuTtVA3EqtZGlOJL5mlPmPxSVm85sIbXs5RkUgiYE?= =?us-ascii?Q?2SUW5pPyEo0iXmhnez0qDIozNgcCLZKAs9?= X-Forefront-PRVS: 0378F1E47A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(39840400002)(39850400002)(39450400003)(39400400002)(39410400002)(39860400002)(199003)(189002)(4326008)(81156014)(7350300001)(81166006)(50226002)(50466002)(68736007)(36756003)(38730400002)(1076002)(110136004)(53936002)(6116002)(25786009)(48376002)(8676002)(86362001)(305945005)(54906002)(7736002)(2950100002)(6666003)(50986999)(101416001)(47776003)(105586002)(5660300001)(5003940100001)(7416002)(33646002)(106356001)(66066001)(6486002)(7406005)(97736004)(189998001)(3846002)(76176999)(2906002)(53416004)(42186005)(478600001)(309714004);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR12MB0150;H:ubuntu-010236106000.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR12MB0150;23:9FQ5XqmWWIyCL6m+Ohs089Tf3ykxwJ3ki3BH+rWxS?= =?us-ascii?Q?lPPvu389Tk0lnQZEGbXqM2YXWPOOt5lUlEzfIfRd/Rs5coLTCRr5Oh3OCETy?= =?us-ascii?Q?glQ/UAGLaG5GYb5KIOi6sJq7M0vZ2ODyVRym54G7SoMrBG2XxSNdIqnGlY7D?= =?us-ascii?Q?PnlK9onNQ2ke6DU4IVtinDb/1KWR1y+hn2tq707UiIoAnxBLJI2EwzlLQoWI?= =?us-ascii?Q?JNfqWbO0GevW9+c78iorL80vOaj65UEhzsPMLgyevX16OBe5rw4wt4urKgBp?= =?us-ascii?Q?pcFDSzQwkaSeOKqoc9txk7nB0T8ywU4rl0uXIO7xMiGCmJ+bxe2RnU2qelbp?= =?us-ascii?Q?axICB11/IrF4wjBUv7K/s5wKNPxsXsfcJFH1fJmf19bOA6cX19FRh+QInOHd?= =?us-ascii?Q?c2iUIZ1dUmKP0dRvwK61Vjv/dtAHAs4o1aYiHnGRxkbBaJTaxC9jUYKLOD7U?= =?us-ascii?Q?PY4Cwy9E/LdQMTA2oU1nN50JfwNVXaXQF042RogbDclChiCo4FAKLcBevDG+?= =?us-ascii?Q?5Zx/icROxOavvOyOeMd2STEkj1iYjjMHEaCfxd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YpRJhQ78wkG8sHVMex4a3TTcQ//k?= =?us-ascii?Q?hImzLVoXDg7RXjo/RAj4AneVYcc6xaWFv4EvPTy5usm8ubJFFxeNfhXt/Kqj?= =?us-ascii?Q?cS4bqRL3XpE2eIJ4XMGLWT?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;5:fXUMneuP3wXdvrnfGMvI1IjP9y5rInK/WNcL2pdXiwMH4ed1aEzPMC4VQjrHYBzqlPBfYe62QW2UOkASbWIWEMRGH1cRPQi6qN+ikhW/lojtTBWTSzux4WBmlChCS/Uybq7PyiztXajI/g7oX9jsL1BeyAI4Ekgrp9PJz+cPPn45ClPfk41yWoEEc2uHIg2lJh+eXl2Pa84NcJOUI/JmcZPS5ErIUB1+0lm9+AGcr96FjRPV1e8YGnMEToNldYuPVDWjVhTTmr0TePniHMwMJz2NzsH2pdGKGXLMksGl4RDNSjdiIPeZCpndxVjCn3OFoU9rgn0/M+x+ejafSknABw5zQeFNOa6eeyDi+9HdYM+Ee8ncIKbWjQm4qDWywds0RHFmetsiLw/gppcGfN06iR4cqsaNn5p7GkwRc9O71p+zIOLqAvynKOq40GOImiC6MTZzxIs27zSS3RrO+tt2ARWAI3BbZkV4UHPNb72RUjPgsbO1Xq+dLjvwJUlNbxz/;24:i1FjIVMaten2XJlmKrhNbgGbGcu9XoJHsABjqtF/P+q/P8qMsr4s7OUU7JapOijFTiQoryHfRH6jlmOEiVMM5TnWbT9gL1HB9gDdVbEeKCQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;7:KVpVxiqg1SxRhCowaeT5v5PrP5emQ5Eq1Mwt0yK650G4CS4FehqdGkiL39BkZDF2HES4/6KQCIi9UuDG4Ltpi94zXQiz+PhQCziWj11O7qvRqlrvbzWj1dhUsT49IUPFyY/9MX8bB7d/Aengcq5mUoMWWngowu99Z6MAK2C+cZxAC0OVnDAlKSXUMhKD8j6/d71Dt1lY3Q7eBRvCl/J/mMA256+2zu4+Lv6Es6r3vtFeZRzlqdWT7z6EGfqDDYlXoedU2jw56AKMdqMQG2+R63LUT57OMEZaC1Ylr74JvgodjuV4kHzJZaSEOyY3RV5jv2UKHkMkzV8m+7jn4b6UPaIsSFbDm7JqpuyjhzqpedS3VDYAQUR+ZYJKrQDSKKdY2nVVNZu6wMBmQDVXuTsOysVRn9YzR9EFaaf3yrawedhGjIMausL10VWay0pd3fwCpXD1ppIPr2lFTUN3Nuf8o9EMunMttwmjGyC+Ux13PbSJp8uUFav1eJbIRq7XI0cipeFvIFb/htS/KoMnB6pKXUb/F3BmD1UIAVmgZp6BN18l57BKaeP0njuJ6/G3TpnLxUQCAlQg5InxBjbfWnPiPNB4O4p8M2Q/0sH6WEOkagKsceXOs/eDI1fIDlF4fk+xjBxfrwabahkOI+O3iteyBPFLpD8YNYAg6IuCHUpmLybJqK6lmaVX4ldywCLNnJW6MTssGVkRQbOPj9RoUFnV3USLaHZQY3LsVRShEE/MDY734B52awaSygiwXvw+iSl5Aljm512SC6YwYs3BY7bLBDcMmn2MVYK9akQ/ndUZMkU= X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;20:s0ima6U/aK3+l92jxubkQpZVByYwx44TBoAAV5PtNcBZUl0Tvdi0dCODjP+gNexFdmNPpgVWvAW5easBJubAr6vo0gCF1zaWnoCzemuoAfc3BcbEPl9TIPrddaF++vHDZB0a7w5WPCeZLlr8Gq6uq4QLspFJz76cYO90Mh8y4aelXLevPjm+I5/YJNBTI7GQnHULuEm0wgB6XvIvsPy4Yg6SX6X9XDVG2WND4nYF76bzax0xXDxsnVI2X6c9L2QH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2017 19:08:19.3253 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0150 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2332 Lines: 74 From: Tom Lendacky Provide support for Secure Encyrpted Virtualization (SEV). This initial support defines a flag that is used by the kernel to determine if it is running with SEV active. Signed-off-by: Tom Lendacky Signed-off-by: Brijesh Singh --- arch/x86/include/asm/mem_encrypt.h | 2 ++ arch/x86/mm/mem_encrypt.c | 3 +++ include/linux/mem_encrypt.h | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index 8e618fc..9274ec7 100644 --- a/arch/x86/include/asm/mem_encrypt.h +++ b/arch/x86/include/asm/mem_encrypt.h @@ -22,6 +22,7 @@ #ifdef CONFIG_AMD_MEM_ENCRYPT extern unsigned long sme_me_mask; +extern unsigned int sev_enabled; void sme_encrypt_execute(unsigned long encrypted_kernel_vaddr, unsigned long decrypted_kernel_vaddr, @@ -50,6 +51,7 @@ void swiotlb_set_mem_attributes(void *vaddr, unsigned long size); #else /* !CONFIG_AMD_MEM_ENCRYPT */ #define sme_me_mask 0UL +#define sev_enabled 0 static inline void __init sme_early_encrypt(resource_size_t paddr, unsigned long size) { } diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 0fbd092..1e4643e 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -40,6 +40,9 @@ static char sme_cmdline_off[] __initdata = "off"; unsigned long sme_me_mask __section(.data) = 0; EXPORT_SYMBOL_GPL(sme_me_mask); +unsigned int sev_enabled __section(.data) = 0; +EXPORT_SYMBOL_GPL(sev_enabled); + /* Buffer used for early in-place encryption by BSP, no locking needed */ static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE); diff --git a/include/linux/mem_encrypt.h b/include/linux/mem_encrypt.h index 1255f09..ea0831a 100644 --- a/include/linux/mem_encrypt.h +++ b/include/linux/mem_encrypt.h @@ -22,12 +22,18 @@ #else /* !CONFIG_ARCH_HAS_MEM_ENCRYPT */ #define sme_me_mask 0UL +#define sev_enabled 0 #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ static inline bool sme_active(void) { - return !!sme_me_mask; + return (sme_me_mask && !sev_enabled); +} + +static inline bool sev_active(void) +{ + return (sme_me_mask && sev_enabled); } static inline unsigned long sme_get_me_mask(void) -- 2.9.4