From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io, kraxel@redhat.com
Cc: Oliver Steffen <osteffen@redhat.com>,
Leif Lindholm <quic_llindhol@quicinc.com>,
Pawel Polawski <ppolawsk@redhat.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Sami Mujawar <sami.mujawar@arm.com>
Subject: Re: [edk2-devel] [PATCH 1/1] ArmVirt: don't use unaligned CopyMem () on NOR flash
Date: Mon, 16 Jan 2023 12:50:06 +0100 [thread overview]
Message-ID: <CAMj1kXE2e0W0GU-bS_tH=VY521A1xsa+vWXd3HqeptvVg7QFOA@mail.gmail.com> (raw)
In-Reply-To: <CAMj1kXHFXep2uEG9sG1fH4grNGthUb8v-VAT7ZN3yMe_ZY57KQ@mail.gmail.com>
On Mon, 16 Jan 2023 at 12:10, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Mon, 16 Jan 2023 at 10:46, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> > Fixes: e5ec3ba409b5 ("OvmfPkg/VirtNorFlashDxe: map flash memory as uncacheable")
> > Signed-off-by: Gerd Hoffmann <kraxel@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()")
>
Merged as #3903.
> > ---
> > 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
> >
> >
> >
> >
> >
> >
prev parent reply other threads:[~2023-01-16 11:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 9:46 [PATCH 1/1] ArmVirt: don't use unaligned CopyMem () on NOR flash Gerd Hoffmann
2023-01-16 11:10 ` [edk2-devel] " Ard Biesheuvel
2023-01-16 11:50 ` Ard Biesheuvel [this message]
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='CAMj1kXE2e0W0GU-bS_tH=VY521A1xsa+vWXd3HqeptvVg7QFOA@mail.gmail.com' \
--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