From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824AbcEJNoG (ORCPT ); Tue, 10 May 2016 09:44:06 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:37969 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbcEJNoC (ORCPT ); Tue, 10 May 2016 09:44:02 -0400 Date: Tue, 10 May 2016 14:43:58 +0100 From: Matt Fleming To: Tom Lendacky Cc: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , Arnd Bergmann , Jonathan Corbet , Joerg Roedel , Konrad Rzeszutek Wilk , Paolo Bonzini , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , Thomas Gleixner , Dmitry Vyukov Subject: Re: [RFC PATCH v1 10/18] x86/efi: Access EFI related tables in the clear Message-ID: <20160510134358.GR2839@codeblueprint.co.uk> References: <20160426225553.13567.19459.stgit@tlendack-t1.amdoffice.net> <20160426225740.13567.85438.stgit@tlendack-t1.amdoffice.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160426225740.13567.85438.stgit@tlendack-t1.amdoffice.net> User-Agent: Mutt/1.5.24+41 (02bc14ed1569) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Apr, at 05:57:40PM, Tom Lendacky wrote: > The EFI tables are not encrypted and need to be accessed as such. Be sure > to memmap them without the encryption attribute set. For EFI support that > lives outside of the arch/x86 tree, create a routine that uses the __weak > attribute so that it can be overridden by an architecture specific routine. > > When freeing boot services related memory, since it has been mapped as > un-encrypted, be sure to change the mapping to encrypted for future use. > > Signed-off-by: Tom Lendacky > --- > arch/x86/include/asm/cacheflush.h | 3 + > arch/x86/include/asm/mem_encrypt.h | 22 +++++++++++ > arch/x86/kernel/setup.c | 6 +-- > arch/x86/mm/mem_encrypt.c | 56 +++++++++++++++++++++++++++ > arch/x86/mm/pageattr.c | 75 ++++++++++++++++++++++++++++++++++++ > arch/x86/platform/efi/efi.c | 26 +++++++----- > arch/x86/platform/efi/efi_64.c | 9 +++- > arch/x86/platform/efi/quirks.c | 12 +++++- > drivers/firmware/efi/efi.c | 18 +++++++-- > drivers/firmware/efi/esrt.c | 12 +++--- > include/linux/efi.h | 3 + > 11 files changed, 212 insertions(+), 30 deletions(-) The size of this change is completely unexpected. Why is there so much churn to workaround this new feature? Is it not possible to maintain some kind of kernel virtual address mapping so memremap*() and friends can figure out when to twiddle the mapping attributes and map with/without encryption? These API changes place an undue burden on developers that don't even care about SME.