From nobody Sat Nov 2 14:38:53 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489534393367474.90098597523513; Tue, 14 Mar 2017 16:33:13 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E3333803F4; Tue, 14 Mar 2017 16:33:04 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 6FF1680331 for ; Tue, 14 Mar 2017 16:33:03 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BF9EC04B95F; Tue, 14 Mar 2017 23:33:04 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-194.phx2.redhat.com [10.3.116.194]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2ENWpwb006449; Tue, 14 Mar 2017 19:33:03 -0400 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 15 Mar 2017 00:32:39 +0100 Message-Id: <20170314233246.17864-8-lersek@redhat.com> In-Reply-To: <20170314233246.17864-1-lersek@redhat.com> References: <20170314233246.17864-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 14 Mar 2017 23:33:04 +0000 (UTC) Subject: [edk2] [PATCH 07/14] OvmfPkg: conditionally disable reserved memory varstore emulation at build X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" (All of the below is only relevant for SMM_REQUIRE=3DFALSE.) For the emulated variable store, PlatformPei allocates reserved memory (as early as possible, so that the address remains the same during reboot), and PcdEmuVariableNvStoreReserved carries the address to EmuVariableFvbRuntimeDxe. In addition, QemuFlashFvbServicesRuntimeDxe is always launched before EmuVariableFvbRuntimeDxe, so that if flash variables are available, QemuFlashFvbServicesRuntimeDxe can set PcdFlashNvStorageVariableBase64 first, and EmuVariableFvbRuntimeDxe can exit early. This ordering is currently enforced by adding QemuFlashFvbServicesRuntimeDxe to the APRIORI DXE file. All of this is unnecessary when MEM_VARSTORE_EMU_ENABLE is set to FALSE. In such a build, - (almost) remove the dynamic default for PcdEmuVariableNvStoreReserved (we can't really do this because the PcdSet64() in ReserveEmuVariableNvStore() wouldn't compile), - prevent the reserved memory allocation and PCD setting in PlatformPei, - exclude EmuVariableFvbRuntimeDxe, - and drop QemuFlashFvbServicesRuntimeDxe from the APRIORI DXE file (since it doesn't have to beat EmuVariableFvbRuntimeDxe in setting PcdFlashNvStorageVariableBase64 any longer). Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/OvmfPkgIa32.dsc | 4 +++- OvmfPkg/OvmfPkgIa32X64.dsc | 4 +++- OvmfPkg/OvmfPkgX64.dsc | 4 +++- OvmfPkg/OvmfPkgIa32.fdf | 4 +++- OvmfPkg/OvmfPkgIa32X64.fdf | 4 +++- OvmfPkg/OvmfPkgX64.fdf | 4 +++- OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/Platform.c | 3 ++- 8 files changed, 21 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index c3d7d146ecb7..416868ab51fb 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -474,7 +474,7 @@ [PcdsFixedAtBuild] =20 [PcdsDynamicDefault] # only set when - # ($(SMM_REQUIRE) =3D=3D FALSE) + # (($(SMM_REQUIRE) =3D=3D FALSE) && ($(MEM_VARSTORE_EMU_ENABLE) =3D=3D= TRUE)) gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 =20 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 @@ -840,10 +840,12 @@ [Components] # Variable driver stack (non-SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +!if $(MEM_VARSTORE_EMU_ENABLE) =3D=3D TRUE OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.i= nf } +!endif MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 55a6c66e986d..ca661fb09410 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -480,7 +480,7 @@ [PcdsFixedAtBuild.X64] =20 [PcdsDynamicDefault] # only set when - # ($(SMM_REQUIRE) =3D=3D FALSE) + # (($(SMM_REQUIRE) =3D=3D FALSE) && ($(MEM_VARSTORE_EMU_ENABLE) =3D=3D= TRUE)) gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 =20 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 @@ -849,10 +849,12 @@ [Components.X64] # Variable driver stack (non-SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +!if $(MEM_VARSTORE_EMU_ENABLE) =3D=3D TRUE OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.i= nf } +!endif MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 400c96ee4b0f..0205ca987aee 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -479,7 +479,7 @@ [PcdsFixedAtBuild] =20 [PcdsDynamicDefault] # only set when - # ($(SMM_REQUIRE) =3D=3D FALSE) + # (($(SMM_REQUIRE) =3D=3D FALSE) && ($(MEM_VARSTORE_EMU_ENABLE) =3D=3D= TRUE)) gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 =20 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 @@ -847,10 +847,12 @@ [Components] # Variable driver stack (non-SMM) # OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +!if $(MEM_VARSTORE_EMU_ENABLE) =3D=3D TRUE OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf { PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.i= nf } +!endif MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index 09c165882c3f..ce6641f534d0 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -190,7 +190,7 @@ [FV.DXEFV] APRIORI DXE { INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf -!if $(SMM_REQUIRE) =3D=3D FALSE +!if ($(SMM_REQUIRE) =3D=3D FALSE) && ($(MEM_VARSTORE_EMU_ENABLE) =3D=3D TR= UE) INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf !endif } @@ -376,7 +376,9 @@ [FV.DXEFV] # Variable driver stack (non-SMM) # INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +!if $(MEM_VARSTORE_EMU_ENABLE) =3D=3D TRUE INF OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf +!endif INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf !endif diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index 5233314139bc..c28a3080bee7 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -190,7 +190,7 @@ [FV.DXEFV] APRIORI DXE { INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf -!if $(SMM_REQUIRE) =3D=3D FALSE +!if ($(SMM_REQUIRE) =3D=3D FALSE) && ($(MEM_VARSTORE_EMU_ENABLE) =3D=3D TR= UE) INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf !endif } @@ -376,7 +376,9 @@ [FV.DXEFV] # Variable driver stack (non-SMM) # INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +!if $(MEM_VARSTORE_EMU_ENABLE) =3D=3D TRUE INF OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf +!endif INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf !endif diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index 36150101e784..00c539ca5e4a 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -190,7 +190,7 @@ [FV.DXEFV] APRIORI DXE { INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf -!if $(SMM_REQUIRE) =3D=3D FALSE +!if ($(SMM_REQUIRE) =3D=3D FALSE) && ($(MEM_VARSTORE_EMU_ENABLE) =3D=3D TR= UE) INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf !endif } @@ -376,7 +376,9 @@ [FV.DXEFV] # Variable driver stack (non-SMM) # INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf +!if $(MEM_VARSTORE_EMU_ENABLE) =3D=3D TRUE INF OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf +!endif INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf !endif diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Plat= formPei.inf index a1e12c1fc7e2..9c1ffa9815c1 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -103,6 +103,7 @@ [FixedPcd] =20 [FeaturePcd] gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire + gUefiOvmfPkgTokenSpaceGuid.PcdMemVarstoreEmuEnable =20 [Ppis] gEfiPeiMasterBootModePpiGuid diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 041eb9d189b4..ec449b422eda 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -661,7 +661,8 @@ InitializePlatform ( mHostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); =20 if (mBootMode !=3D BOOT_ON_S3_RESUME) { - if (!FeaturePcdGet (PcdSmmSmramRequire)) { + if (!FeaturePcdGet (PcdSmmSmramRequire) && + FeaturePcdGet (PcdMemVarstoreEmuEnable)) { ReserveEmuVariableNvStore (); } PeiFvInitialization (); --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel