From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Lendacky Subject: Re: [RFC PATCH v4 05/28] x86: Add Secure Memory Encryption (SME) support Date: Tue, 28 Feb 2017 17:01:36 -0600 Message-ID: <9ea3d871-e4ae-2408-1bd0-9820cc5826d6@amd.com> References: <20170216154158.19244.66630.stgit@tlendack-t1.amdoffice.net> <20170216154307.19244.72895.stgit@tlendack-t1.amdoffice.net> <20170225152931.p4lws753myepkkb3@pd.tnic> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170225152931.p4lws753myepkkb3-fF5Pk5pvG8Y@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Borislav Petkov Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Brijesh Singh , Toshimitsu Kani , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Matt Fleming , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Alexander Potapenko , "H. Peter Anvin" , Larry Woodman , linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jonathan Corbet , linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kasan-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Ingo Molnar , Andrey Ryabinin , Rik van Riel , Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Dmitry Vyukov , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, "Michael S. Tsirkin" , Paolo Bonzini List-Id: linux-efi@vger.kernel.org On 2/25/2017 9:29 AM, Borislav Petkov wrote: > On Thu, Feb 16, 2017 at 09:43:07AM -0600, Tom Lendacky wrote: >> Add support for Secure Memory Encryption (SME). This initial support >> provides a Kconfig entry to build the SME support into the kernel and >> defines the memory encryption mask that will be used in subsequent >> patches to mark pages as encrypted. >> >> Signed-off-by: Tom Lendacky > > ... > >> +++ b/arch/x86/include/asm/mem_encrypt.h >> @@ -0,0 +1,42 @@ >> +/* >> + * AMD Memory Encryption Support >> + * >> + * Copyright (C) 2016 Advanced Micro Devices, Inc. >> + * >> + * Author: Tom Lendacky >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> + */ >> + >> +#ifndef __X86_MEM_ENCRYPT_H__ >> +#define __X86_MEM_ENCRYPT_H__ >> + >> +#ifndef __ASSEMBLY__ >> + >> +#ifdef CONFIG_AMD_MEM_ENCRYPT >> + >> +extern unsigned long sme_me_mask; >> + >> +static inline bool sme_active(void) >> +{ >> + return (sme_me_mask) ? true : false; > > return !!sme_me_mask; Done. Thanks, Tom >