From: Jordan Justen <jordan.l.justen@intel.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>,
Gary Ching-Pang Lin <glin@suse.com>
Subject: Re: [PATCH v2 3/5] OvmfPkg: introduce 4MB flash image (mainly) for Windows HCK
Date: Fri, 05 May 2017 01:57:17 -0700 [thread overview]
Message-ID: <149397463765.13335.18098739662202283758@jljusten-skl> (raw)
In-Reply-To: <bdf196e8-df87-84b9-1d6e-bbece5fa65b7@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]
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 264KB,
>
> Unfortunately, we have a terrible regression here. :(
>
<snip>
> 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
[-- Attachment #2: 0001-PlatformPei-Force-EmuVariableNvStore-alignment-size-.patch --]
[-- Type: text/x-diff, Size: 1847 bytes --]
>From 58ba393adf60caf806b26dec9aa56d936743f595 Mon Sep 17 00:00:00 2001
From: Jordan Justen <jordan.l.justen@intel.com>
Date: Fri, 5 May 2017 01:43:31 -0700
Subject: [PATCH] PlatformPei: Force EmuVariableNvStore alignment size to power
of two
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
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 = 2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize);
+ SizeHighBit = HighBitSet32 (EmuFvbSize);
+ if ((EmuFvbSize & (EmuFvbSize - 1)) != 0) {
+ SizeHighBit++;
+ }
//
// Allocate storage for NV variables early on so it will be
@@ -514,13 +522,13 @@ ReserveEmuVariableNvStore (
VariableStore =
(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 = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);
ASSERT_RETURN_ERROR (PcdStatus);
--
2.11.0
next prev parent reply other threads:[~2017-05-05 8:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 21:39 [PATCH v2 0/5] OvmfPkg: add FD_SIZE_4MB for Windows HCK SB tests, and for future proofing Laszlo Ersek
2017-05-03 21:39 ` [PATCH v2 1/5] OvmfPkg: introduce the FD_SIZE_IN_KB macro / build flag Laszlo Ersek
2017-05-03 21:39 ` [PATCH v2 2/5] OvmfPkg/OvmfPkg.fdf.inc: extract VARS_LIVE_SIZE and VARS_SPARE_SIZE macros Laszlo Ersek
2017-05-03 21:39 ` [PATCH v2 3/5] OvmfPkg: introduce 4MB flash image (mainly) for Windows HCK Laszlo Ersek
2017-05-05 4:07 ` Laszlo Ersek
2017-05-05 8:57 ` Jordan Justen [this message]
2017-05-05 12:07 ` Laszlo Ersek
2017-05-05 15:43 ` Jordan Justen
2017-05-05 16:46 ` Laszlo Ersek
2017-05-03 21:39 ` [PATCH v2 4/5] OvmfPkg: raise max variable size (auth & non-auth) to 33KB for FD_SIZE_4MB Laszlo Ersek
2017-05-04 16:36 ` Jordan Justen
2017-05-04 16:52 ` Laszlo Ersek
2017-05-04 18:50 ` Jordan Justen
2017-05-04 19:27 ` Laszlo Ersek
2017-05-04 19:30 ` Laszlo Ersek
2017-05-04 23:00 ` Laszlo Ersek
2017-05-03 21:39 ` [PATCH v2 5/5] OvmfPkg: make the 4MB flash size the default Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=149397463765.13335.18098739662202283758@jljusten-skl \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox