Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 16bf588b604a9f190accb71ada715b81756c94e2
      
https://github.com/tianocore/edk2/commit/16bf588b604a9f190accb71ada715b81756c94e2
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    A OvmfPkg/Include/Library/VirtNorFlashPlatformLib.h
    M OvmfPkg/OvmfPkg.dec

  Log Message:
  -----------
  OvmfPkg: clone NorFlashPlatformLib into VirtNorFlashPlatformLib

Create a new library class in Ovmf that duplicates the existing
NorFlashPlatformLib, but which will be tied to the VirtNorFlashDxe
driver that will be introduced in a subsequent patch. This allows us to
retire the original from ArmPlatformPkg.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: c1ff81f7990be88c9e98ca3be65178057d8aae77
      
https://github.com/tianocore/edk2/commit/c1ff81f7990be88c9e98ca3be65178057d8aae77
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    A OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
    A OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h
    A OvmfPkg/VirtNorFlashDxe/VirtNorFlashBlockIoDxe.c
    A OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
    A OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
    A OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c

  Log Message:
  -----------
  OvmfPkg/VirtNorFlashDxe: clone ArmPlatformPkg's NOR flash driver

QEMU's mach-virt is loosely based on ARM Versatile Express, and inherits
its NOR flash driver, which is now being used on other QEMU emulated
architectures as well.

In order to permit ourselves the freedom to optimize this driver for
use under KVM emulation, let's clone it into OvmfPkg, so we have a
version we can hack without the risk of regressing bare metal platforms.

The cloned version is mostly identical to the original, but it depends
on the newly added VirtNorFlashPlatformLib library class instead of the
original one from ArmPlatformPkg. Beyond that, only cosmetic changes
related to #include order etc were made.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: 0a64106c566273ff8ef951d56ddfa972fe65bd6c
      
https://github.com/tianocore/edk2/commit/0a64106c566273ff8ef951d56ddfa972fe65bd6c
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf

  Log Message:
  -----------
  OvmfPkg/VirtNorFlashDxe: remove CheckBlockLocked feature

We inherited a feature from the ArmPlatformPkg version of this driver
that never gets enabled. Let's remove it.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: 68d234989b2d6bd8f255577e08bf8be0b1d197bb
      
https://github.com/tianocore/edk2/commit/68d234989b2d6bd8f255577e08bf8be0b1d197bb
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h
    R OvmfPkg/VirtNorFlashDxe/VirtNorFlashBlockIoDxe.c
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c

  Log Message:
  -----------
  OvmfPkg/VirtNorFlashDxe: remove disk I/O protocol implementation

We only use NOR flash for firmware volumes, either for executable images
or for the variable store. So we have no need for exposing disk I/O on
top of the NOR flash partitions so let's remove it.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: 83f11f957240ead9b135a778316330762b0a3acb
      
https://github.com/tianocore/edk2/commit/83f11f957240ead9b135a778316330762b0a3acb
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c

  Log Message:
  -----------
  OvmfPkg/VirtNorFlashDxe: drop block I/O protocol implementation

We never boot from NOR flash, and generally rely on the firmware volume
PI protocols to expose the contents. So drop the block I/O protocol
implementation from VirtNorFlashDxe.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: ca01e6216a8d1a26c69018e216d1dc3f88a819a4
      
https://github.com/tianocore/edk2/commit/ca01e6216a8d1a26c69018e216d1dc3f88a819a4
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c

  Log Message:
  -----------
  OvmfPkg/VirtNorFlashDxe: avoid array mode switch after each word write

NorFlashWriteSingleWord() switches into programming mode and back into
array mode for every single word that it writes. Under KVM, this
involves tearing down the read-only memslot, and setting it up again,
which is costly and unnecessary.

Instead, move the array mode switch into the callers, and only make the
switch when the writing is done.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: 25589c4a76e7e3668fd6f794dd1827e958b6719c
      
https://github.com/tianocore/edk2/commit/25589c4a76e7e3668fd6f794dd1827e958b6719c
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c

  Log Message:
  -----------
  OvmfPkg/VirtNorFlashDxe: avoid switching between modes in a tight loop

Currently, when dealing with small updates that can be written out
directly (i.e., if they only involve clearing bits and not setting bits,
as the latter requires a block level erase), we iterate over the data
one word at a time, read the old value, compare it, write the new value,
and repeat, unless we encountered a value that we cannot write (0->1
transition), in which case we fall back to a block level operation.

This is inefficient for two reasons:
- reading and writing a word at a time involves switching between array
and programming mode for every word of data, which is
disproportionately costly when running under KVM;
- we end up writing some data twice, as we may not notice that a block
erase is needed until after some data has been written to flash.

So replace this sequence with a single read of up to twice the buffered
write maximum size, followed by one or two buffered writes if the data
can be written directly. Otherwise, fall back to the existing block
level sequence, but without writing out part of the data twice.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: 789a723285533f35652ebd6029976e2ddc955655
      
https://github.com/tianocore/edk2/commit/789a723285533f35652ebd6029976e2ddc955655
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
    M OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c

  Log Message:
  -----------
  OvmfPkg/VirtNorFlashDxe: use EFI_MEMORY_WC and drop AlignedCopyMem()

NOR flash emulation under KVM involves switching between two modes,
where array mode is backed by a read-only memslot, and programming mode
is fully emulated, i.e., the memory region is not backed by anything,
and the faulting accesses are forwarded to the VMM by the hypervisor,
which translates them into NOR flash programming commands.

Normally, we are limited to the use of device attributes when mapping
such regions, given that the programming mode has MMIO semantics.
However, when running under KVM, the chosen memory attributes only take
effect when in array mode, since no memory mapping exists otherwise.

This means we can tune the memory mapping so it behaves a bit more like
a ROM, by switching to EFI_MEMORY_WC attributes. This means we no longer
need a special CopyMem() implementation that avoids unaligned accesses
at all cost.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: b92298af8218dd074c231947bc95f2be94af663c
      
https://github.com/tianocore/edk2/commit/b92298af8218dd074c231947bc95f2be94af663c
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M ArmVirtPkg/ArmVirtQemu.dsc
    M ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
    M ArmVirtPkg/ArmVirtQemuKernel.dsc
    M ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c
    M ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf

  Log Message:
  -----------
  ArmVirtPkg/ArmVirtQemu: migrate to OVMF's VirtNorFlashDxe

Switch to the virt specific NorFlashDxe driver implementation that was
added recently.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


  Commit: 99338ef81ed6e48be57f71c01af85fbbdd7030ed
      
https://github.com/tianocore/edk2/commit/99338ef81ed6e48be57f71c01af85fbbdd7030ed
  Author: Ard Biesheuvel <a...@kernel.org>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M ArmVirtPkg/ArmVirtKvmTool.dsc
    M ArmVirtPkg/ArmVirtKvmTool.fdf
    M ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtool.c
    M ArmVirtPkg/Library/NorFlashKvmtoolLib/NorFlashKvmtoolLib.inf

  Log Message:
  -----------
  ArmVirtPkg/ArmVirtKvmTool: Migrate to OVMF's VirtNorFlashDxe

Migrate to the virt specific NOR flash driver as the ArmPlatformPkg is
going away.

Signed-off-by: Ard Biesheuvel <a...@kernel.org>
Reviewed-by: Sunil V L <suni...@ventanamicro.com>


Compare: https://github.com/tianocore/edk2/compare/115cebbe4d75...99338ef81ed6


_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to