From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1C5CC4338F for ; Tue, 10 Aug 2021 20:12:46 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6653B60F13 for ; Tue, 10 Aug 2021 20:12:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6653B60F13 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gkkdm3QhKz3bXc for ; Wed, 11 Aug 2021 06:12:44 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.helo=mga12.intel.com (client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=sathyanarayanan.kuppuswamy@linux.intel.com; receiver=) X-Greylist: delayed 124 seconds by postgrey-1.36 at boromir; Wed, 11 Aug 2021 06:12:15 AEST Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GkkdC3j5gz2yM4 for ; Wed, 11 Aug 2021 06:12:15 +1000 (AEST) X-IronPort-AV: E=McAfee;i="6200,9189,10072"; a="194572507" X-IronPort-AV: E=Sophos;i="5.84,310,1620716400"; d="scan'208";a="194572507" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2021 13:09:06 -0700 X-IronPort-AV: E=Sophos;i="5.84,310,1620716400"; d="scan'208";a="515971399" Received: from pdmuelle-desk2.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.213.166.202]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2021 13:09:05 -0700 Subject: Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has() To: Tom Lendacky , linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-graphics-maintainer@vmware.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org References: <029791b24c6412f9427cfe6ec598156c64395964.1627424774.git.thomas.lendacky@amd.com> <166f30d8-9abb-02de-70d8-6e97f44f85df@linux.intel.com> <4b885c52-f70a-147e-86bd-c71a8f4ef564@amd.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: <4f9effcb-055b-51ee-6722-c9f0cc1d8acf@linux.intel.com> Date: Tue, 10 Aug 2021 13:09:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <4b885c52-f70a-147e-86bd-c71a8f4ef564@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andi Kleen , Tianyu Lan , Daniel Vetter , Baoquan He , Peter Zijlstra , Thomas Zimmermann , Joerg Roedel , Dave Hansen , Maarten Lankhorst , Maxime Ripard , David Airlie , Dave Young , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Brijesh Singh , Thomas Gleixner , Will Deacon , "Kirill A. Shutemov" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 8/10/21 12:48 PM, Tom Lendacky wrote: > On 8/10/21 1:45 PM, Kuppuswamy, Sathyanarayanan wrote: >> >> >> On 7/27/21 3:26 PM, Tom Lendacky wrote: >>> diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c >>> index de01903c3735..cafed6456d45 100644 >>> --- a/arch/x86/kernel/head64.c >>> +++ b/arch/x86/kernel/head64.c >>> @@ -19,7 +19,7 @@ >>>   #include >>>   #include >>>   #include >>> -#include >>> +#include >>>   #include >>>     #include >>> @@ -285,7 +285,7 @@ unsigned long __head __startup_64(unsigned long >>> physaddr, >>>        * there is no need to zero it after changing the memory encryption >>>        * attribute. >>>        */ >>> -    if (mem_encrypt_active()) { >>> +    if (prot_guest_has(PATTR_MEM_ENCRYPT)) { >>>           vaddr = (unsigned long)__start_bss_decrypted; >>>           vaddr_end = (unsigned long)__end_bss_decrypted; >> >> >> Since this change is specific to AMD, can you replace PATTR_MEM_ENCRYPT with >> prot_guest_has(PATTR_SME) || prot_guest_has(PATTR_SEV). It is not used in >> TDX. > > This is a direct replacement for now. I think the change you're requesting > should be done as part of the TDX support patches so it's clear why it is > being changed. Ok. I will include it part of TDX changes. > > But, wouldn't TDX still need to do something with this shared/unencrypted > area, though? Or since it is shared, there's actually nothing you need to > do (the bss decrpyted section exists even if CONFIG_AMD_MEM_ENCRYPT is not > configured)? Kirill had a requirement to turn on CONFIG_AMD_MEM_ENCRYPT for adding lazy accept support in TDX guest kernel. Kirill, can you add details here? > > Thanks, > Tom > >> -- Sathyanarayanan Kuppuswamy Linux Kernel Developer