public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: devel@edk2.groups.io
Cc: leif.lindholm@linaro.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	awarkentin@vmware.com, jeremy.linton@arm.com, pete@akeo.ie,
	samer.el-haj-mahmoud@arm.com
Subject: [PATCH v2 0/2] EmbeddedPkg: support for RPi4 PCI and platform DMA
Date: Tue, 26 Nov 2019 00:12:40 +0100	[thread overview]
Message-ID: <20191125231242.12193-1-ard.biesheuvel@linaro.org> (raw)

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


             reply	other threads:[~2019-11-25 23:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 23:12 Ard Biesheuvel [this message]
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

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=20191125231242.12193-1-ard.biesheuvel@linaro.org \
    --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