public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, leif.lindholm@linaro.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2 0/4] ArmPkg: more ArmDmaLib fixes
Date: Sat, 12 Nov 2016 14:02:24 +0100	[thread overview]
Message-ID: <1478955748-14819-1-git-send-email-ard.biesheuvel@linaro.org> (raw)

Using patch #4 in anger (which was the only patch in the v1 submission of
this series) revealed some issues in the ArmDmaLib code related to abuse
of the device address where a CPU physical address (which usually, but
not always translates 1:1 to a CPU virtual address) was dereferenced by
the CPU.

Patch #1 is an unrelated fix that drops the direct dependency on ArmLib.

Patch #2 adds a missing virtual-to-physical conversion (which is required
when DebugUncachedMemoryAllocationLib is in use)

The device address of a DMA mapping is not to be dereferenced by the CPU,
especially not after patch #4 is applied, which allows the bus view and
the CPU view to be shifted by a fixed offset. So patch #3 corrects some
wrong uses of the device address.

Patch #4 is the original patch, with some in-code comments added to further
clarify how the offset should be specified, and why ConvertToPhysicalAddress()
needs to be called before taking this offset into account.  

Ard Biesheuvel (4):
  ArmPkg/ArmDmaLib: use DMA buffer alignment from CPU arch protocol
  ArmPkg/ArmDmaLib: fix incorrect device address of double buffer
  ArmPkg/ArmDmaLib: clean up abuse of device address
  ArmPkg/ArmDmaLib: add support for fixed host-to-device DMA offset

 ArmPkg/ArmPkg.dec                      |  8 +++
 ArmPkg/Library/ArmDmaLib/ArmDmaLib.c   | 51 +++++++++++++-------
 ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf |  3 +-
 3 files changed, 42 insertions(+), 20 deletions(-)

-- 
2.7.4



             reply	other threads:[~2016-11-12 13:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12 13:02 Ard Biesheuvel [this message]
2016-11-12 13:02 ` [PATCH v2 1/4] ArmPkg/ArmDmaLib: use DMA buffer alignment from CPU arch protocol Ard Biesheuvel
2016-11-14 15:18   ` Leif Lindholm
2016-11-12 13:02 ` [PATCH v2 2/4] ArmPkg/ArmDmaLib: fix incorrect device address of double buffer Ard Biesheuvel
2016-11-14 15:13   ` Leif Lindholm
2016-11-12 13:02 ` [PATCH v2 3/4] ArmPkg/ArmDmaLib: clean up abuse of device address Ard Biesheuvel
2016-11-14 15:16   ` Leif Lindholm
2016-11-15  9:19     ` Ard Biesheuvel
2016-11-15 11:34       ` Ryan Harkin
2016-11-15 13:07         ` Ard Biesheuvel
2016-11-15 18:01           ` Leif Lindholm
2016-11-30 16:45             ` Leif Lindholm
2016-11-12 13:02 ` [PATCH v2 4/4] ArmPkg/ArmDmaLib: add support for fixed host-to-device DMA offset Ard Biesheuvel
2016-11-14 15:17   ` Leif Lindholm

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=1478955748-14819-1-git-send-email-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