public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/2] EmbeddedPkg: support for RPi4 PCI and platform DMA
@ 2019-11-25 23:12 Ard Biesheuvel
  2019-11-25 23:12 ` [PATCH v2 1/2] EmbeddedPkg/NonCoherentDmaLib: implement support for DMA range limits Ard Biesheuvel
  2019-11-25 23:12 ` [PATCH v2 2/2] EmbeddedPkg: implement EDK2 IoMmu protocol wrapping DmaLib Ard Biesheuvel
  0 siblings, 2 replies; 12+ messages in thread
From: Ard Biesheuvel @ 2019-11-25 23:12 UTC (permalink / raw)
  To: devel
  Cc: leif.lindholm, Ard Biesheuvel, awarkentin, jeremy.linton, pete,
	samer.el-haj-mahmoud

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-11-26 12:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-25 23:12 [PATCH v2 0/2] EmbeddedPkg: support for RPi4 PCI and platform DMA Ard Biesheuvel
2019-11-25 23:12 ` [PATCH v2 1/2] EmbeddedPkg/NonCoherentDmaLib: implement support for DMA range limits Ard Biesheuvel
2019-11-26 10:28   ` [edk2-devel] " Pete Batard
2019-11-26 10:44   ` Philippe Mathieu-Daudé
2019-11-26 11:59     ` Philippe Mathieu-Daudé
2019-11-26 12:02       ` Ard Biesheuvel
2019-11-26 12:04   ` Leif Lindholm
2019-11-26 12:11     ` Ard Biesheuvel
2019-11-26 12:22       ` Leif Lindholm
2019-11-25 23:12 ` [PATCH v2 2/2] EmbeddedPkg: implement EDK2 IoMmu protocol wrapping DmaLib Ard Biesheuvel
2019-11-26  8:19   ` [edk2-devel] " Philippe Mathieu-Daudé
2019-11-26 10:28     ` Pete Batard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox