On Mon, 16 Jan 2023 at 10:46, Gerd Hoffmann <kra...@redhat.com> wrote:
>
> Fixes: e5ec3ba409b5 ("OvmfPkg/VirtNorFlashDxe: map flash memory as 
> uncacheable")
> Signed-off-by: Gerd Hoffmann <kra...@redhat.com>

Thanks Gerd.

I'll tweak the fixes line and the commit log a bit:

Commit 789a72328553 reclassified the NOR flash region as EFI_MEMORY_WC
in the OS visible EFI memory map, and dropped the explicit aligned
CopyMem() implementation, in the assumption that EFI_MEMORY_WC will be
honored by the OS, and that the region will be mapped in a way that
tolerates misaligned accesses. However, Linux today uses device
attributes for all EFI MMIO regions, in spite of the memory type
attributes, and so using misaligned accesses is never safe.

So instead, switch to the generic CopyMem() implementation entirely,
just like we already did for VariableRuntimeDxe.

Fixes: 789a72328553 ("OvmfPkg/VirtNorFlashDxe: use EFI_MEMORY_WC and
drop AlignedCopyMem()")

> ---
>  ArmVirtPkg/ArmVirtKvmTool.dsc    | 6 +++++-
>  ArmVirtPkg/ArmVirtQemu.dsc       | 6 +++++-
>  ArmVirtPkg/ArmVirtQemuKernel.dsc | 6 +++++-
>  3 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
> index 2ba00bd08ff1..d0afe1b49e25 100644
> --- a/ArmVirtPkg/ArmVirtKvmTool.dsc
> +++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
> @@ -296,7 +296,11 @@ [Components.common]
>        
> NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
>    }
>
> -  OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
> +  OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf {
> +    <LibraryClasses>
> +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region
> +      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> +  }
>
>    MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index 5dd8b6104cca..0f1c6395488a 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -428,7 +428,11 @@ [Components.common]
>      <LibraryClasses>
>        
> NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
>    }
> -  OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
> +  OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf {
> +    <LibraryClasses>
> +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region
> +      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> +  }
>    MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>
>    #
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc 
> b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> index f5db3ac432f3..807c85d48285 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> @@ -331,7 +331,11 @@ [Components.common]
>      <LibraryClasses>
>        
> NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
>    }
> -  OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
> +  OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf {
> +    <LibraryClasses>
> +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region
> +      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> +  }
>    MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>
>    #
> --
> 2.39.0
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98568): https://edk2.groups.io/g/devel/message/98568
Mute This Topic: https://groups.io/mt/96303660/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to