From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C24F9211E2BF4 for ; Wed, 20 Mar 2019 18:03:09 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2019 18:03:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,250,1549958400"; d="scan'208";a="156880874" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 20 Mar 2019 18:03:08 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 20 Mar 2019 18:03:08 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 20 Mar 2019 18:03:07 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.163]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.252]) with mapi id 14.03.0415.000; Thu, 21 Mar 2019 09:03:06 +0800 From: "Zeng, Star" 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" Thread-Topic: [RFC PATCH] MdeModulePkg: add LockBoxNullLib for !IA32/X64 in .dsc Thread-Index: AQHU3ZrRdLTmwQMzIUCg9krPRVZtSKYUF4aAgAAv+ACAAQC9QA== Date: Thu, 21 Mar 2019 01:03:04 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB048310402980DA@shsmsx102.ccr.corp.intel.com> References: <20190318145625.29000-1-leif.lindholm@linaro.org> <87af2f8b-a8f7-a437-a4ab-019178bb1f13@redhat.com> <20190320174320.rzuprck56u2f5d5u@bivouac.eciton.net> In-Reply-To: <20190320174320.rzuprck56u2f5d5u@bivouac.eciton.net> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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: Thu, 21 Mar 2019 01:03:10 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 Thanks, Star -----Original Message----- From: Leif Lindholm [mailto:leif.lindholm@linaro.org]=20 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, >=20 > On 03/18/19 15:56, Leif Lindholm wrote: > > Commit 05fd2a926833 > > ("MdeModulePkg/NvmExpressPei: Consume S3StorageDeviceInitList=20 > > LockBox") added a dependency on LockBoxLib to NvmExpressPei, causing=20 > > builds using MdeModulePkg.dsc to fail on architectures other than=20 > > IA32/X64 with missing reference to=20 > > gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode. > >=20 > > Add a resolution for LockBoxNullLib for ARM/AARCH64 to restore builds. > >=20 > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Leif Lindholm > > --- > >=20 > > Note: this patch hides the symptom, but this isn't really the fix I=20 > > would like to see. > >=20 > > The build error is caused by the chain of: > > 1) NvmExpressPei depending on LockBoxLib > > 2) LockBoxLib being mapped to SmmLockBoxPeiLib in=20 > > [LibraryClasses.common.PEIM] > > 3) SmmLockBoxPeiLib depending on PcdDxeIplSwitchToLongMode > > 4) PcdDxeIplSwitchToLongMode being declared in > > [PcdsFeatureFlag.IA32, PcdsFeatureFlag.X64] in MdeModulePkg.dsc > >=20 > > Now, an alternative quick-fix would be to move the PEIM LockBoxLib=20 > > mapping into a [LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM]=20 > > section. But that would leave NvmExpressPei unbuildable on anything=20 > > not IA32/X64. > >=20 > > Another option would be to add default declaration (for all other > > architectures) of FALSE for PcdDxeIplSwitchToLongMode in=20 > > MdeModulePkg.dec, but the current way this is expressed seems to=20 > > treat this as an architecture-specific feature (which it is). > >=20 > > What I believe would be the cleanest solution would be to abstract=20 > > NvmExpressPei to the point where it can function without the LockBoxLib= . > > But regardless, it does not look valid to me for something as=20 > > architecture-specific as MdeModulePkg/Library/SmmLockBoxLib/ to live=20 > > under .common sections in the .dsc. (And if this changes at some=20 > > point, because we implement an ARM/AARCH64 equivalent based on=20 > > StandaloneMmPkg, we will need a major refactoring of that library=20 > > anyway.) > >=20 > > / > > Leif > >=20 > > MdeModulePkg/MdeModulePkg.dsc | 1 + > > 1 file changed, 1 insertion(+) > >=20 > > diff --git a/MdeModulePkg/MdeModulePkg.dsc=20 > > 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 > > =20 > > # > > # It is not possible to prevent ARM compiler calls to generic intrin= sic functions. > >=20 >=20 > I think this patch is exactly the right solution. >=20 > The code added in commit 05fd2a926833 is gated by (BootMode =3D=3D=20 > BOOT_ON_S3_RESUME). That condition can never evaluate to TRUE on=20 > ARM/AARCH64, presently. Accordingly, the stated goal of the commit=20 > doesn't apply to ARM/AARCH64: >=20 > The purpose is to perform an on-demand (partial) NVM Express device > enumeration/initialization to benefit the S3 resume performance. >=20 > Given that the RestoreLockBox() calls are never reached (which is=20 > correct, by design, at the present level of ACPI S3 enablement in edk2=20 > for ARM/AARCH64), causing the lockbox APIs to "do nothing beyond=20 > compile" is exactly right. IMO anyway. >=20 > Once ARM/AARCH64 grow S3 support, a functional and secure LockBox will=20 > have to be part of that. Perhaps it will use "standalone MM"; I'm not=20 > sure. The point is, once the goal of the commit starts applying to=20 > ARM/AARCH64, a functional LockBox will have been implemented for=20 > ARM/AARCH64; and that lib instance will certainly not depend on=20 > PcdDxeIplSwitchToLongMode. >=20 > 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 >=20 > Thanks > Laszlo