[edk2-devel] [PATCH v2 0/2] EmbeddedPkg: support for RPi4 PCI and platform DMA

Ard Biesheuvel posted 2 patches 1 week ago
Failed in applying to current master (apply log)
.../NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c | 257 ++++++++++++++++++
.../NonCoherentIoMmuDxe.inf                   |  43 +++
EmbeddedPkg/EmbeddedPkg.dec                   |   6 +
EmbeddedPkg/EmbeddedPkg.dsc                   |   5 +
.../NonCoherentDmaLib/NonCoherentDmaLib.c     | 165 ++++++++++-
.../NonCoherentDmaLib/NonCoherentDmaLib.inf   |   1 +
6 files changed, 465 insertions(+), 12 deletions(-)
create mode 100644 EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
create mode 100644 EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf

[edk2-devel] [PATCH v2 0/2] EmbeddedPkg: support for RPi4 PCI and platform DMA

Posted by Ard Biesheuvel 1 week ago
This set implements two changes to the support we have in EmbeddedPkg
for non-coherent DMA, which together should allow the Raspberry Pi4 to
use both the platform and PCI based DMA devices.

Patch #1 implements support for limiting DMA to a certain memory region.
This is necessary given that the RPi4 ships with more than 1 GB of memory
in some configurations, but uses DMA translation for the platform devices
in a way that puts that memory out of reach for 32-bit DMA (i.e., the DMA
translation is +3 GB). By setting the device DMA limit to MAX_UINT32, the
library will infer a host address limit of 1 GB, and use bounce buffering
if any buffers are mapped outside that region.

Patch #2 implements a trivial wrapper around DmaLib that exposes the EDK2
IoMmu protocol. This is used by the generic PCI infrastructure instead of
the builtin DMA routines when the protocol exists, so it is a natural place
to implement the non-cache coherent DMA handling we need for the RPi4.

Tested on Raspberry Pi 4.

Changes since v1:
- fix a few major issues in #1
- add Leif's ack to #2

Cc: awarkentin@vmware.com
Cc: jeremy.linton@arm.com
Cc: pete@akeo.ie
Cc: samer.el-haj-mahmoud@arm.com

Ard Biesheuvel (2):
  EmbeddedPkg/NonCoherentDmaLib: implement support for DMA range limits
  EmbeddedPkg: implement EDK2 IoMmu protocol wrapping DmaLib

 .../NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c | 257 ++++++++++++++++++
 .../NonCoherentIoMmuDxe.inf                   |  43 +++
 EmbeddedPkg/EmbeddedPkg.dec                   |   6 +
 EmbeddedPkg/EmbeddedPkg.dsc                   |   5 +
 .../NonCoherentDmaLib/NonCoherentDmaLib.c     | 165 ++++++++++-
 .../NonCoherentDmaLib/NonCoherentDmaLib.inf   |   1 +
 6 files changed, 465 insertions(+), 12 deletions(-)
 create mode 100644 EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.c
 create mode 100644 EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf

-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51252): https://edk2.groups.io/g/devel/message/51252
Mute This Topic: https://groups.io/mt/61950461/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-