From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: Sami Mujawar <sami.mujawar@arm.com>, devel@edk2.groups.io
Cc: leif@nuviainc.com, michael.d.kinney@intel.com,
liming.gao@intel.com, Alexandru.Elisei@arm.com,
Andre.Przywara@arm.com, Matteo.Carlini@arm.com,
Laura.Moretta@arm.com, nd@arm.com
Subject: Re: [PATCH v1 03/11] MdePkg: Base Memory Lib instance using MMIO
Date: Thu, 14 May 2020 19:21:27 +0200 [thread overview]
Message-ID: <c38e9395-614a-68e9-ebaf-0e253bb7ed79@arm.com> (raw)
In-Reply-To: <97b8028a-018f-0f91-90ab-a336b0c2ba24@arm.com>
On 5/14/20 11:22 AM, Ard Biesheuvel wrote:
> Hi Sami,
>
> On 5/14/20 10:40 AM, Sami Mujawar wrote:
>> Some device drivers perform copy operations on
>> device memory, e.g. device drivers for a Flash
>> device. On some architectures unaligned access
>> to device memory regions is not permitted. To
>> add to this if the device is virtualised then
>> there are further restrictions on the type of
>> load/store operations that can be performed
>> on the device memory regions, e.g. on AARCH64,
>> Pre/Post index or LDP operations cannot be
>> used, as a trap to EL2 does not provide the
>> syndrome information to the hypervisor.
>>
>
> We are conflating two different things here:
> - the use of unaligned accesses to read from device memory
> - the use of load/store instructions that have multiple output
> registers, making it very difficult to emulate them in a virtual machine
> context.
>
> I though that for the kvmtool port, we addressed the second issue by
> using a read-only memslot for the NOR flash when it is in array mode?
> IIRC, the issue only affects reads, as all writes to NOR flash device
> memory are already done using the proper MMIO accessors. If those MMIO
> accessors compile to something that does not work under emulation, you
> should be use the special IoLib implementation that exists for this use
> case:
>
> MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
>
> So that leaves the issue of unaligned accesses to device memory. This
> should not happen unless you are using BaseMemoryLibOptDxe for AARCH64,
> which deliberately uses overlapping loads and stores for performance.
> Any BASE library is built with -mstrict-align, and so any other C code
> implementation of BaseMemoryLib should work fine for reading for a
> read-only memslot mapped using device attributes.
>
> So in summary, I don't think we need this library.
>
BTW I think the AlignedCopyMem() introduction predates the changes to
use -mstrict-align for BASE libraries, and to use the ordinary
BaseMemoryLib implementation for DXE_RUNTIME_DRIVER modules on AArch64.
next prev parent reply other threads:[~2020-05-14 17:21 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 8:40 [PATCH v2 00/11] Kvmtool guest firmware support for Arm Sami Mujawar
2020-05-14 8:40 ` [PATCH v2 01/11] PcAtChipsetPkg: Add MMIO Support to RTC driver Sami Mujawar
2020-05-14 9:24 ` Ard Biesheuvel
2020-05-15 10:50 ` André Przywara
2020-05-27 0:37 ` [edk2-devel] " Guomin Jiang
2020-05-14 8:40 ` [PATCH v1 02/11] MdePkg: Add NULL implementation for PCILib Sami Mujawar
2020-05-14 9:23 ` Ard Biesheuvel
2020-05-14 16:21 ` Michael D Kinney
2020-05-14 8:40 ` [PATCH v1 03/11] MdePkg: Base Memory Lib instance using MMIO Sami Mujawar
2020-05-14 9:22 ` Ard Biesheuvel
2020-05-14 17:21 ` Ard Biesheuvel [this message]
2020-05-14 16:33 ` [edk2-devel] " Michael D Kinney
2020-05-14 8:40 ` [PATCH v1 04/11] ArmPlatformPkg: Use MMIO to read device memory Sami Mujawar
2020-05-14 8:40 ` [PATCH v1 05/11] ArmPlatformPkg: Dynamic flash variable base Sami Mujawar
2020-05-14 9:24 ` Ard Biesheuvel
2020-05-27 11:48 ` [edk2-devel] " Philippe Mathieu-Daudé
2020-05-14 8:40 ` [PATCH v2 06/11] ArmVirtPkg: Add kvmtool platform driver Sami Mujawar
2020-05-14 9:29 ` Ard Biesheuvel
2020-05-14 12:12 ` [edk2-devel] " Laszlo Ersek
2020-05-14 12:17 ` Ard Biesheuvel
2020-05-14 16:05 ` Laszlo Ersek
2020-05-14 17:25 ` Ard Biesheuvel
2020-05-15 7:28 ` Laszlo Ersek
2020-05-14 12:20 ` Laszlo Ersek
2020-05-14 8:40 ` [PATCH v1 07/11] ArmVirtPkg: kvmtool platform memory map Sami Mujawar
2020-05-14 9:30 ` Ard Biesheuvel
2020-05-14 12:15 ` [edk2-devel] " Laszlo Ersek
2020-05-14 8:40 ` [PATCH v1 08/11] ArmVirtPkg: Add Kvmtool NOR flash lib Sami Mujawar
2020-05-14 9:32 ` Ard Biesheuvel
2020-05-14 12:17 ` [edk2-devel] " Laszlo Ersek
2020-05-27 11:59 ` Philippe Mathieu-Daudé
2020-06-04 6:30 ` Philippe Mathieu-Daudé
2020-06-04 15:00 ` Sami Mujawar
2020-05-14 8:40 ` [PATCH v2 09/11] ArmVirtPkg: Support for kvmtool emulated platform Sami Mujawar
2020-05-14 9:56 ` Ard Biesheuvel
2020-05-14 12:24 ` [edk2-devel] " Laszlo Ersek
2020-05-14 8:40 ` [PATCH v1 10/11] ArmVirtPkg: Link NorFlashDxe with BaseMemoryLibMmio Sami Mujawar
2020-05-14 12:28 ` [edk2-devel] " Laszlo Ersek
2020-05-14 8:40 ` [PATCH v1 11/11] Maintainer.txt: Add Kvmtool emulated plat maintainer Sami Mujawar
2020-05-14 12:31 ` [edk2-devel] " Laszlo Ersek
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=c38e9395-614a-68e9-ebaf-0e253bb7ed79@arm.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