From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751772AbdG0Ome (ORCPT ); Thu, 27 Jul 2017 10:42:34 -0400 Received: from mail.skyhub.de ([5.9.137.197]:60132 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbdG0Omd (ORCPT ); Thu, 27 Jul 2017 10:42:33 -0400 Date: Thu, 27 Jul 2017 16:41:59 +0200 From: Borislav Petkov To: Tom Lendacky Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Ingo Molnar , Andy Lutomirski , "H. Peter Anvin" , Thomas Gleixner , Dave Young , Brijesh Singh Subject: Re: [PATCH v1 2/2] acpi, x86: Remove encryption mask from ACPI page protection type Message-ID: <20170727144159.GD28548@nazgul.tnic> References: <45cc8e44980cbc1372c63420ebafc8c8466e958f.1501092102.git.thomas.lendacky@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <45cc8e44980cbc1372c63420ebafc8c8466e958f.1501092102.git.thomas.lendacky@amd.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 26, 2017 at 01:04:34PM -0500, Tom Lendacky wrote: > The function arch_apei_get_mem_attributes() is used to set the page > protection type for ACPI physical addresses. When SME is active, the > associated protection type needs to not have the encryption mask set > since the ACPI tables live in un-encrypted memory. Modify the > arch_apei_get_mem_attributes() function to remove the encryption mask > when SME is active by returning the PAGE_KERNEL_IO protection type. > > Signed-off-by: Tom Lendacky > --- > arch/x86/include/asm/acpi.h | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h > index 562286f..89df39d 100644 > --- a/arch/x86/include/asm/acpi.h > +++ b/arch/x86/include/asm/acpi.h > @@ -34,6 +34,7 @@ > > #ifdef CONFIG_ACPI_APEI > # include > +# include > #endif > > #ifdef CONFIG_ACPI > @@ -164,8 +165,12 @@ static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr) > * anything other than PAGE_KERNEL (some arm64 platforms > * require the equivalent of PAGE_KERNEL_NOCACHE), return that > * until we know differently. > + * > + * When SME is active, the ACPI information will not reside in > + * in memory in an encrypted state so return a protection attribute > + * that does not have the encryption bit set. > */ > - return PAGE_KERNEL; > + return sme_active() ? PAGE_KERNEL_IO : PAGE_KERNEL; Why isn't there a PAGE_KERNEL_NOENC define which you can simply return instead of testing? -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --