From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1956F211E8303 for ; Fri, 22 Mar 2019 11:13:15 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id t124so3058616wma.4 for ; Fri, 22 Mar 2019 11:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xW+hME+GfiHZ8fM8qaasMX9FajgJG6Kg7U3aKtq1Cuo=; b=BVUC9TEF1M7zL2C+llKdMUgWFxZ5VnRbUOeCwDZzmirk0c/RoCvl6cXgK+4ATcfJOA t/uoTpklo3HX4A6KdYU8uWIMtm4RtLnyKIUpbUw/4HsGUNbsCDMLyYTgWgX4LGjT+qcr Z0RG7dc7c3byL2bvlBXBo+8M6OzUnnLS8vf5l3NKSRRZUAfsUwZJMW7RtenBdjZg1Jwc sE88xzozWnImEQ3fJmPQVjJBCHXXYmZNP4E47Np3DgCkDlA/CfhP0OlvZuA8CyMmM+aU dxBB0LVW+OPO2HsSFMCaxc7hEeRcdJL3QgibLf+pdRsoNsYQJHDfLiGxzeqfvy/GeNrg o0fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xW+hME+GfiHZ8fM8qaasMX9FajgJG6Kg7U3aKtq1Cuo=; b=khpDtyNt6XYDbBl+9XXFVzu7fawDu1W/C/NHZTi5+xq9LibqHVhbTflFV/0FnAxnbQ eU11QsU7TJATYIEr/40hSbGKapAL7vxtp8JcfRMjE5lt+83/qofvM66bTTd5kwhLU3bV jsFJsXMpXgNiG/DsPddO+ywgVTyj/44Y/qtViPMeNf4iplGf6uGnnPGnWMfABRFEShHr kCju4neXj36hUZFZHXCiEVhdkTesD2TWFXv/YCYUYAMwEs2ua0vuYiWwkn5plNyzJ1CT OMsiEzSNqaW6xVRxie3d+InNmQOlbzpuLw9LLZLxupqpwUmmfqvcHLkDsowIUi+cMngo Q7jw== X-Gm-Message-State: APjAAAXHGdcnWwccgFnpOSw7SZN/ablHDcT9CM7AiMDSgeOGguzHou56 hJT3fv/NnJS776HYtrEdbqwhUA== X-Google-Smtp-Source: APXvYqynAONFsu9ica4TDrZMeLn4gpXwsrB1ikQL/cVnN7yXBBMndE5m1fVli2fz030P3YuNPIpw4g== X-Received: by 2002:a1c:dfc5:: with SMTP id w188mr3799298wmg.79.1553278393882; Fri, 22 Mar 2019 11:13:13 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id a82sm8871419wmf.11.2019.03.22.11.13.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Mar 2019 11:13:12 -0700 (PDT) Date: Fri, 22 Mar 2019 18:13:11 +0000 From: Leif Lindholm To: "Wu, Hao A" Cc: "Zeng, Star" , Laszlo Ersek , "edk2-devel@lists.01.org" , "ard.biesheuvel@linaro.org" , "Wang, Jian J" , "Ni, Ray" , Andrew Fish , "Kinney, Michael D" Message-ID: <20190322181311.bu5d55bjngfwlqt2@bivouac.eciton.net> References: <20190318145625.29000-1-leif.lindholm@linaro.org> <87af2f8b-a8f7-a437-a4ab-019178bb1f13@redhat.com> <20190320174320.rzuprck56u2f5d5u@bivouac.eciton.net> <0C09AFA07DD0434D9E2A0C6AEB048310402980DA@shsmsx102.ccr.corp.intel.com> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [RFC PATCH] MdeModulePkg: add LockBoxNullLib for !IA32/X64 in .dsc X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 18:13:16 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Mar 21, 2019 at 03:27:45AM +0000, Wu, Hao A wrote: > > -----Original Message----- > > From: Zeng, Star > > Sent: Thursday, March 21, 2019 9:03 AM > > To: Leif Lindholm; Laszlo Ersek > > Cc: edk2-devel@lists.01.org; ard.biesheuvel@linaro.org; Wang, Jian J; Wu, > > Hao A; Ni, Ray; Andrew Fish; Kinney, Michael D; Zeng, Star > > Subject: RE: [RFC PATCH] MdeModulePkg: add LockBoxNullLib for !IA32/X64 > > in .dsc > > > > Another way to update the file is > > > > [LibraryClasses.EBC] > > LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf > > > > -> > > > > [LibraryClasses.EBC, LibraryClasses.ARM, LibraryClasses.AARCH64] > > LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf > > Hello Leif, > > The current proposed patch seems great to me. > Reviewed-by: Hao Wu > > I am also fine with the above suggestion by Star. So if you prefer the > above approach, please feel free to propose another patch. Thanks in > advance. Laszlo convinced me that this change makes sense. But the argument for that was that each architecture needs to decide itself how to implement LockBoxLib (or not). What does not make sense to me is that MdeModulePkg/Library/SmmLockBoxLib/ is used as a global default, and set as the resolution for LockBoxLib in common sections, when it is only valid for 2 of the 6 architectures supported by the UEFI specification. My original version is my preferred way of addressing the immediate problem though, mainly to keep the separate .EBC section. Best Regards, Leif > Best Regards, > Hao Wu > > > > > > > Thanks, > > Star > > -----Original Message----- > > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > > Sent: Thursday, March 21, 2019 1:43 AM > > To: Laszlo Ersek > > Cc: edk2-devel@lists.01.org; ard.biesheuvel@linaro.org; Wang, Jian J > > ; Wu, Hao A ; Ni, Ray > > ; Zeng, Star ; Andrew Fish > > ; Kinney, Michael D > > Subject: Re: [RFC PATCH] MdeModulePkg: add LockBoxNullLib for !IA32/X64 > > in .dsc > > > > On Wed, Mar 20, 2019 at 03:51:39PM +0100, Laszlo Ersek wrote: > > > Hi Leif, > > > > > > On 03/18/19 15:56, Leif Lindholm wrote: > > > > Commit 05fd2a926833 > > > > ("MdeModulePkg/NvmExpressPei: Consume S3StorageDeviceInitList > > > > LockBox") added a dependency on LockBoxLib to NvmExpressPei, causing > > > > builds using MdeModulePkg.dsc to fail on architectures other than > > > > IA32/X64 with missing reference to > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode. > > > > > > > > Add a resolution for LockBoxNullLib for ARM/AARCH64 to restore builds. > > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > Signed-off-by: Leif Lindholm > > > > --- > > > > > > > > Note: this patch hides the symptom, but this isn't really the fix I > > > > would like to see. > > > > > > > > The build error is caused by the chain of: > > > > 1) NvmExpressPei depending on LockBoxLib > > > > 2) LockBoxLib being mapped to SmmLockBoxPeiLib in > > > > [LibraryClasses.common.PEIM] > > > > 3) SmmLockBoxPeiLib depending on PcdDxeIplSwitchToLongMode > > > > 4) PcdDxeIplSwitchToLongMode being declared in > > > > [PcdsFeatureFlag.IA32, PcdsFeatureFlag.X64] in MdeModulePkg.dsc > > > > > > > > Now, an alternative quick-fix would be to move the PEIM LockBoxLib > > > > mapping into a [LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM] > > > > section. But that would leave NvmExpressPei unbuildable on anything > > > > not IA32/X64. > > > > > > > > Another option would be to add default declaration (for all other > > > > architectures) of FALSE for PcdDxeIplSwitchToLongMode in > > > > MdeModulePkg.dec, but the current way this is expressed seems to > > > > treat this as an architecture-specific feature (which it is). > > > > > > > > What I believe would be the cleanest solution would be to abstract > > > > NvmExpressPei to the point where it can function without the LockBoxLib. > > > > But regardless, it does not look valid to me for something as > > > > architecture-specific as MdeModulePkg/Library/SmmLockBoxLib/ to live > > > > under .common sections in the .dsc. (And if this changes at some > > > > point, because we implement an ARM/AARCH64 equivalent based on > > > > StandaloneMmPkg, we will need a major refactoring of that library > > > > anyway.) > > > > > > > > / > > > > Leif > > > > > > > > MdeModulePkg/MdeModulePkg.dsc | 1 + > > > > 1 file changed, 1 insertion(+) > > > > > > > > diff --git a/MdeModulePkg/MdeModulePkg.dsc > > > > b/MdeModulePkg/MdeModulePkg.dsc index 6cd1727a0d..6e27e9cb68 > > 100644 > > > > --- a/MdeModulePkg/MdeModulePkg.dsc > > > > +++ b/MdeModulePkg/MdeModulePkg.dsc > > > > @@ -178,6 +178,7 @@ [LibraryClasses.common.MM_STANDALONE] > > > > [LibraryClasses.ARM, LibraryClasses.AARCH64] > > > > ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf > > > > ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf > > > > + LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf > > > > > > > > # > > > > # It is not possible to prevent ARM compiler calls to generic intrinsic > > functions. > > > > > > > > > > I think this patch is exactly the right solution. > > > > > > The code added in commit 05fd2a926833 is gated by (BootMode == > > > BOOT_ON_S3_RESUME). That condition can never evaluate to TRUE on > > > ARM/AARCH64, presently. Accordingly, the stated goal of the commit > > > doesn't apply to ARM/AARCH64: > > > > > > The purpose is to perform an on-demand (partial) NVM Express device > > > enumeration/initialization to benefit the S3 resume performance. > > > > > > Given that the RestoreLockBox() calls are never reached (which is > > > correct, by design, at the present level of ACPI S3 enablement in edk2 > > > for ARM/AARCH64), causing the lockbox APIs to "do nothing beyond > > > compile" is exactly right. IMO anyway. > > > > > > Once ARM/AARCH64 grow S3 support, a functional and secure LockBox will > > > have to be part of that. Perhaps it will use "standalone MM"; I'm not > > > sure. The point is, once the goal of the commit starts applying to > > > ARM/AARCH64, a functional LockBox will have been implemented for > > > ARM/AARCH64; and that lib instance will certainly not depend on > > > PcdDxeIplSwitchToLongMode. > > > > > > Until such time, this patch is fine. > > > > OK, I buy that argument. > > > > *But* I still think the IA32/X64 specific library mappings should be moved out > > of .common LibraryClass sections. > > > > Regards, > > > > Leif > > > > > Reviewed-by: Laszlo Ersek > > > > > > Thanks > > > Laszlo