d6671b1ccc
- edk2-OvmfPkg-VirtNorFlashDxe-clone-ArmPlatformPkg-s-NOR-f.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-remove-CheckBlockLocked-feat.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-remove-disk-I-O-protocol-imp.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-drop-block-I-O-protocol-impl.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-avoid-array-mode-switch-afte.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-avoid-switching-between-mode.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-use-EFI_MEMORY_WC-and-drop-A.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-stop-accepting-gEfiVariable2.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-sanity-check-variable2.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-add-casts-to-UINTN-and-UINT3.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-clarify-block-write-logic-fi.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-add-a-loop-for-NorFlashWrite.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-allow-larger-writes-without-.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-ValidateFvHeader-unwritten-s.patch [RHEL-17587] - edk2-OvmfPkg-VirtNorFlashDxe-move-DoErase-code-block-into.patch [RHEL-17587] - edk2-ArmVirtPkg-ArmVirtQemu-migrate-to-OVMF-s-VirtNorFlas.patch [RHEL-17587] - edk2-OvmfPkg-clone-NorFlashPlatformLib-into-VirtNorFlashP.patch [RHEL-17587] - Resolves: RHEL-17587 ([rhel8] guest fails to boot due to ASSERT error)
66 lines
3.0 KiB
Diff
66 lines
3.0 KiB
Diff
From 0193a89b0db837da31301bc1edb8382927842978 Mon Sep 17 00:00:00 2001
|
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Date: Tue, 16 Jan 2024 18:11:03 +0100
|
|
Subject: [PATCH 14/18] OvmfPkg/VirtNorFlashDxe: allow larger writes without
|
|
block erase
|
|
|
|
RH-Author: Gerd Hoffmann <None>
|
|
RH-MergeRequest: 43: OvmfPkg/VirtNorFlashDxe backport
|
|
RH-Jira: RHEL-17587
|
|
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
RH-Commit: [16/20] 27ac63b90eb5e6fdc00cbc5a9105c3178ee559cd
|
|
|
|
Raise the limit for writes without block erase from two to four
|
|
P30_MAX_BUFFER_SIZE_IN_BYTES blocks. With this in place almost all efi
|
|
variable updates are handled without block erase. With the old limit
|
|
some variable updates (with device paths) took the block erase code
|
|
path.
|
|
|
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
Message-Id: <20240116171105.37831-5-kraxel@redhat.com>
|
|
(cherry picked from commit b25733c97442513890ae6bb8e10fd340f13844a7)
|
|
---
|
|
OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c | 18 ++++++++++--------
|
|
1 file changed, 10 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
|
|
index 3d1343b381..3d1d20daa1 100644
|
|
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
|
|
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
|
|
@@ -550,13 +550,15 @@ NorFlashWriteSingleBlock (
|
|
return EFI_BAD_BUFFER_SIZE;
|
|
}
|
|
|
|
- // Pick P30_MAX_BUFFER_SIZE_IN_BYTES (== 128 bytes) as a good start for word
|
|
- // operations as opposed to erasing the block and writing the data regardless
|
|
- // if an erase is really needed. It looks like most individual NV variable
|
|
- // writes are smaller than 128 bytes.
|
|
- // To avoid pathological cases were a 2 byte write is disregarded because it
|
|
- // occurs right at a 128 byte buffered write alignment boundary, permit up to
|
|
- // twice the max buffer size, and perform two writes if needed.
|
|
+ // Pick 4 * P30_MAX_BUFFER_SIZE_IN_BYTES (== 512 bytes) as a good
|
|
+ // start for word operations as opposed to erasing the block and
|
|
+ // writing the data regardless if an erase is really needed.
|
|
+ //
|
|
+ // Many NV variable updates are small enough for a a single
|
|
+ // P30_MAX_BUFFER_SIZE_IN_BYTES block write. In case the update is
|
|
+ // larger than a single block, or the update crosses a
|
|
+ // P30_MAX_BUFFER_SIZE_IN_BYTES boundary (as shown in the diagram
|
|
+ // below), or both, we might have to write two or more blocks.
|
|
//
|
|
// 0 128 256
|
|
// [----------------|----------------]
|
|
@@ -578,7 +580,7 @@ NorFlashWriteSingleBlock (
|
|
Start = Offset & ~BOUNDARY_OF_32_WORDS;
|
|
End = ALIGN_VALUE (Offset + *NumBytes, P30_MAX_BUFFER_SIZE_IN_BYTES);
|
|
|
|
- if ((End - Start) <= (2 * P30_MAX_BUFFER_SIZE_IN_BYTES)) {
|
|
+ if ((End - Start) <= (4 * P30_MAX_BUFFER_SIZE_IN_BYTES)) {
|
|
// Check to see if we need to erase before programming the data into NOR.
|
|
// If the destination bits are only changing from 1s to 0s we can just write.
|
|
// After a block is erased all bits in the block is set to 1.
|
|
--
|
|
2.41.0
|
|
|