From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344AbdGRLDr (ORCPT ); Tue, 18 Jul 2017 07:03:47 -0400 Received: from terminus.zytor.com ([65.50.211.136]:56861 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbdGRLDo (ORCPT ); Tue, 18 Jul 2017 07:03:44 -0400 Date: Tue, 18 Jul 2017 03:55:38 -0700 From: tip-bot for Tom Lendacky Message-ID: Cc: matt@codeblueprint.co.uk, peterz@infradead.org, mingo@kernel.org, thomas.lendacky@amd.com, riel@redhat.com, torvalds@linux-foundation.org, glider@google.com, pbonzini@redhat.com, lwoodman@redhat.com, dvyukov@google.com, bp@alien8.de, rkrcmar@redhat.com, dyoung@redhat.com, luto@kernel.org, aryabinin@virtuozzo.com, mst@redhat.com, linux-kernel@vger.kernel.org, brijesh.singh@amd.com, tglx@linutronix.de, hpa@zytor.com, bp@suse.de, corbet@lwn.net, arnd@arndb.de, konrad.wilk@oracle.com, toshi.kani@hpe.com Reply-To: brijesh.singh@amd.com, linux-kernel@vger.kernel.org, luto@kernel.org, rkrcmar@redhat.com, dyoung@redhat.com, aryabinin@virtuozzo.com, mst@redhat.com, pbonzini@redhat.com, bp@alien8.de, lwoodman@redhat.com, dvyukov@google.com, glider@google.com, torvalds@linux-foundation.org, riel@redhat.com, thomas.lendacky@amd.com, mingo@kernel.org, peterz@infradead.org, matt@codeblueprint.co.uk, konrad.wilk@oracle.com, toshi.kani@hpe.com, arnd@arndb.de, hpa@zytor.com, corbet@lwn.net, bp@suse.de, tglx@linutronix.de In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/realmode: Decrypt trampoline area if memory encryption is active Git-Commit-ID: 163ea3c83aeeb3908a51162c79cb3a7c374d92b4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 163ea3c83aeeb3908a51162c79cb3a7c374d92b4 Gitweb: http://git.kernel.org/tip/163ea3c83aeeb3908a51162c79cb3a7c374d92b4 Author: Tom Lendacky AuthorDate: Mon, 17 Jul 2017 16:10:20 -0500 Committer: Ingo Molnar CommitDate: Tue, 18 Jul 2017 11:38:03 +0200 x86/realmode: Decrypt trampoline area if memory encryption is active When Secure Memory Encryption is enabled, the trampoline area must not be encrypted. A CPU running in real mode will not be able to decrypt memory that has been encrypted because it will not be able to use addresses with the memory encryption mask. Signed-off-by: Tom Lendacky Reviewed-by: Thomas Gleixner Reviewed-by: Borislav Petkov Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Andy Lutomirski Cc: Arnd Bergmann Cc: Borislav Petkov Cc: Brijesh Singh Cc: Dave Young Cc: Dmitry Vyukov Cc: Jonathan Corbet Cc: Konrad Rzeszutek Wilk Cc: Larry Woodman Cc: Linus Torvalds Cc: Matt Fleming Cc: Michael S. Tsirkin Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Radim Krčmář Cc: Rik van Riel Cc: Toshimitsu Kani Cc: kasan-dev@googlegroups.com Cc: kvm@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/c70ffd2614fa77e80df31c9169ca98a9b16ff97c.1500319216.git.thomas.lendacky@amd.com Signed-off-by: Ingo Molnar --- arch/x86/realmode/init.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index cd4be19..d6ddc7e 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,13 @@ static void __init setup_real_mode(void) base = (unsigned char *)real_mode_header; + /* + * If SME is active, the trampoline area will need to be in + * decrypted memory in order to bring up other processors + * successfully. + */ + set_memory_decrypted((unsigned long)base, size >> PAGE_SHIFT); + memcpy(base, real_mode_blob, size); phys_base = __pa(base);