From: "Ard Biesheuvel" <ardb@kernel.org>
To: Ashish Singhal <ashishsingha@nvidia.com>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
Marc Zyngier <maz@kernel.org>,
Sami Mujawar <sami.mujawar@arm.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Leif Lindholm <quic_llindhol@quicinc.com>
Subject: Re: [edk2-devel] [PATCH] ArmPkg: Invalidate Instruction Cache On MMU Enable
Date: Wed, 23 Feb 2022 23:54:24 +0100 [thread overview]
Message-ID: <CAMj1kXEY=tgsqAsqv0suidwtF=pH4SKe4LwfxgODTimZxQXJBA@mail.gmail.com> (raw)
In-Reply-To: <CH2PR12MB5546FB7F34DCE25C2B23F2A7BA3C9@CH2PR12MB5546.namprd12.prod.outlook.com>
On Wed, 23 Feb 2022 at 19:14, Ashish Singhal <ashishsingha@nvidia.com> wrote:
>
> Ard,
>
> During PrePi, I setup the initial memory map by calling into ArmConfigureMmu function with my memory table where device memory regions have attribute of ARM_MEMORY_REGION_ATTRIBUTE_DEVICE and DRAM regions have attribute of ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK.
>
> For device memory, XN bit is set by ArmMemoryAttributeToPageAttribute function. After PrePi, when I add a region of memory to device memory from a DXE driver, I call gDS->AddMemorySpace with EfiGcdMemoryTypeMemoryMappedIo and EFI_MEMORY_UC | EFI_MEMORY_RUNTIME followed by gDS->SetMemorySpaceAttributes with EFI_MEMORY_UC.
>
> Please let me know in case I have still not understood your question.
>
This all looks ok. But the real question is whether the address that
the speculative access targets is mapped using the XN attribute or
not, so you will need to find a way to check that.
So there are a couple of options:
- The XN attribute is set correctly, but the CPU is speculatively
fetching instructions anyway. This would imply a severe hardware bug,
and flushing the I-cache is unlikely to make a difference.
- The speculative access is not the result of an instruction fetch, in
which case I-cache maintenance is unlikely to help either.
- The XN bit is not being set correctly, and so the MMU code needs to be fixed.
Papering over this by adding I-cache maintenance doesn't seem the best
course of action tbh.
--
Ard.
next prev parent reply other threads:[~2022-02-23 22:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 2:42 [PATCH] ArmPkg: Invalidate Instruction Cache On MMU Enable Ashish Singhal
2022-02-23 5:07 ` Ashish Singhal
2022-02-23 7:02 ` Ard Biesheuvel
2022-02-23 8:58 ` Marc Zyngier
2022-02-23 17:36 ` Ashish Singhal
2022-02-23 17:40 ` [edk2-devel] " Ard Biesheuvel
2022-02-23 18:13 ` Ashish Singhal
2022-02-23 22:54 ` Ard Biesheuvel [this message]
2022-02-24 6:01 ` Ashish Singhal
2022-02-26 4:46 ` Ashish Singhal
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='CAMj1kXEY=tgsqAsqv0suidwtF=pH4SKe4LwfxgODTimZxQXJBA@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