From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 A83C021A09132 for ; Thu, 18 May 2017 01:16:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E899218E3C7; Thu, 18 May 2017 08:16:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E899218E3C7 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E899218E3C7 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-86.phx2.redhat.com [10.3.116.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 231F317593; Thu, 18 May 2017 08:16:00 +0000 (UTC) To: Jordan Justen , edk2-devel-01 References: <20170505210258.28141-1-lersek@redhat.com> <20170505210258.28141-6-lersek@redhat.com> <149487179135.31444.17454219357311957333@jljusten-skl> From: Laszlo Ersek Message-ID: Date: Thu, 18 May 2017 10:16:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <149487179135.31444.17454219357311957333@jljusten-skl> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 18 May 2017 08:16:02 +0000 (UTC) Subject: Re: [PATCH 5/7] OvmfPkg/PlatformPei: don't allocate reserved mem varstore if SMM_REQUIRE X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 08:16:02 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 05/15/17 20:09, Jordan Justen wrote: > On 2017-05-05 14:02:56, Laszlo Ersek wrote: >> 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. >> >> However, EmuVariableFvbRuntimeDxe is excluded from the SMM_REQUIRE build, >> and then noone consumes PcdEmuVariableNvStoreReserved. Don't waste >> reserved memory whenever that's the case. >> >> (Even a dynamic default for PcdEmuVariableNvStoreReserved would be >> unnecessary; but that way the PcdSet64S() call in the >> ReserveEmuVariableNvStore() function doesn't compile.) >> >> Cc: Jordan Justen >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Laszlo Ersek >> --- >> OvmfPkg/OvmfPkgIa32.dsc | 3 +++ >> OvmfPkg/OvmfPkgIa32X64.dsc | 3 +++ >> OvmfPkg/OvmfPkgX64.dsc | 3 +++ >> OvmfPkg/PlatformPei/Platform.c | 4 +++- >> 4 files changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc >> index 64427716c53c..b46eef6cabc3 100644 >> --- a/OvmfPkg/OvmfPkgIa32.dsc >> +++ b/OvmfPkg/OvmfPkgIa32.dsc >> @@ -495,7 +495,10 @@ [PcdsFixedAtBuild] >> ################################################################################ >> >> [PcdsDynamicDefault] >> + # only set when >> + # ($(SMM_REQUIRE) == FALSE) >> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 >> + >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0 >> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc >> index 887964cd27c2..08f471fbc542 100644 >> --- a/OvmfPkg/OvmfPkgIa32X64.dsc >> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc >> @@ -501,7 +501,10 @@ [PcdsFixedAtBuild.X64] >> ################################################################################ >> >> [PcdsDynamicDefault] >> + # only set when >> + # ($(SMM_REQUIRE) == FALSE) > > I don't think we should bother adding these comments into the .dsc. > > Ultimately, I would prefer to always allocate this, even when SMM is > set to be required. It'd be nice if we could always fallback to > EmuFvb, but I understand that this might not be possible given how > difficult it is to determine if QEMU actually has SMM enabled. Anyway, > I think this patch makes sense until we can potentially fix that. > (Which may or may not be worth fixing.) > > Series Reviewed-by: Jordan Justen Series committed as 11a6cc5bda81..639c7dd86d1d. Thank you, Laszlo > >> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 >> + >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0 >> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc >> index dc5fea3577d4..24053e5ff82d 100644 >> --- a/OvmfPkg/OvmfPkgX64.dsc >> +++ b/OvmfPkg/OvmfPkgX64.dsc >> @@ -500,7 +500,10 @@ [PcdsFixedAtBuild] >> ################################################################################ >> >> [PcdsDynamicDefault] >> + # only set when >> + # ($(SMM_REQUIRE) == FALSE) >> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0 >> + >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0 >> diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c >> index 5e983a8dcea9..1b4dc00b0180 100644 >> --- a/OvmfPkg/PlatformPei/Platform.c >> +++ b/OvmfPkg/PlatformPei/Platform.c >> @@ -672,7 +672,9 @@ InitializePlatform ( >> mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID); >> >> if (mBootMode != BOOT_ON_S3_RESUME) { >> - ReserveEmuVariableNvStore (); >> + if (!FeaturePcdGet (PcdSmmSmramRequire)) { >> + ReserveEmuVariableNvStore (); >> + } >> PeiFvInitialization (); >> MemMapInitialization (); >> NoexecDxeInitialization (); >> -- >> 2.9.3 >> >>