From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 1BFC521A070BA for ; Fri, 5 May 2017 01:57:19 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2017 01:57:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,291,1491289200"; d="scan'208,223";a="95966187" Received: from jcluyand-mobl1.amr.corp.intel.com (HELO localhost) ([10.255.66.185]) by orsmga005.jf.intel.com with ESMTP; 05 May 2017 01:57:18 -0700 MIME-Version: 1.0 To: Laszlo Ersek Message-ID: <149397463765.13335.18098739662202283758@jljusten-skl> From: Jordan Justen In-Reply-To: Cc: edk2-devel-01 , Gary Ching-Pang Lin References: <20170503213947.32290-1-lersek@redhat.com> <20170503213947.32290-4-lersek@redhat.com> User-Agent: alot/0.5.1 Date: Fri, 05 May 2017 01:57:17 -0700 Subject: Re: [PATCH v2 3/5] OvmfPkg: introduce 4MB flash image (mainly) for Windows HCK 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: Fri, 05 May 2017 08:57:19 -0000 X-Groupsio-MsgNum: 10558 Content-Type: multipart/mixed; boundary="===============6472140403627312716==" --===============6472140403627312716== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 2017-05-04 21:07:24, Laszlo Ersek wrote: > On 05/03/17 23:39, Laszlo Ersek wrote: > > - Raise VARS_LIVE_SIZE by 8KB to 256KB, VARS_SPARE_SIZE by 8KB to 2= 64KB, > = > Unfortunately, we have a terrible regression here. :( > > Adapting EmuVariableFvbRuntimeDxe to a non-power-of-two NV spare area > size is hopeless. (Definitely hopeless for the time frame & resources > I'm looking at.) > = > Worse, even -pflash is broken in the 4MB build, actually. The > non-power-of-two NV spare area size, when used as Alignment for > AllocateAlignedRuntimePages() in ReserveEmuVariableNvStore(), triggers > an assertion. And this path is taken for the -pflash boot as well. For a short term fix, would something like this work? 1. Force emu fvb buffer alignment to next power-of-two Something like the attachment, but I'm guessing you already wrote something similar. 2. Revert 4MB by default patch This should allow you to start using the 4MB layout for your builds, and we can fix the non-flash path before re-enabling 4MB as the default. -Jordan --===============6472140403627312716== Content-Type: text/x-diff; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-PlatformPei-Force-EmuVariableNvStore-alignment-size-.patch" Content-Disposition: attachment; filename="0001-PlatformPei-Force-EmuVariableNvStore-alignment-size-.patch" >>From 58ba393adf60caf806b26dec9aa56d936743f595 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 5 May 2017 01:43:31 -0700 Subject: [PATCH] PlatformPei: Force EmuVariableNvStore alignment size to po= wer of two Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen --- OvmfPkg/PlatformPei/Platform.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.= c index 77a8a16c15..97dce8de92 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -504,6 +504,14 @@ ReserveEmuVariableNvStore ( { EFI_PHYSICAL_ADDRESS VariableStore; RETURN_STATUS PcdStatus; + UINT32 EmuFvbSize; + INTN SizeHighBit; + + EmuFvbSize =3D 2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize); + SizeHighBit =3D HighBitSet32 (EmuFvbSize); + if ((EmuFvbSize & (EmuFvbSize - 1)) !=3D 0) { + SizeHighBit++; + } =20 // // Allocate storage for NV variables early on so it will be @@ -514,13 +522,13 @@ ReserveEmuVariableNvStore ( VariableStore =3D (EFI_PHYSICAL_ADDRESS)(UINTN) AllocateAlignedRuntimePages ( - EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)), - PcdGet32 (PcdFlashNvStorageFtwSpareSize) + EFI_SIZE_TO_PAGES (EmuFvbSize), + 1 << (SizeHighBit - 1) ); DEBUG ((EFI_D_INFO, "Reserved variable store memory: 0x%lX; size: %dkb\n", VariableStore, - (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024 + EmuFvbSize / 1024 )); PcdStatus =3D PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore); ASSERT_RETURN_ERROR (PcdStatus); --=20 2.11.0 --===============6472140403627312716==--