]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/IoMmuDxe: rework setup of "MapInfo->PlainTextAddress" in Map()
authorLaszlo Ersek <lersek@redhat.com>
Wed, 2 Aug 2017 13:13:15 +0000 (15:13 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 4 Aug 2017 23:31:53 +0000 (01:31 +0200)
commite130229c0aea069f44fc942e585733b435680a35
tree93d9a341b0a0c94e8b4a385bd462f3aaded1a66c
parentbc1c2e49acbc8ccaf9f1b4f0c93470b4791539dc
OvmfPkg/IoMmuDxe: rework setup of "MapInfo->PlainTextAddress" in Map()

There are three issues with the current calculations:

- The initial logic that sets up "DmaMemoryTop" and "AllocateType" checks
  for the BusMasterCommonBuffer64 operation in two places. The inner check
  for BusMasterCommonBuffer64 will never evaluate to TRUE however, because
  the outer check excludes BusMasterCommonBuffer64.

- In order to lower "DmaMemoryTop" to (SIZE_4GB - 1), the outer check
  requires that the encrypted (original) buffer cross the 4GB mark. This
  is wrong: for BusMasterRead[64] and BusMasterWrite[64] operations, we
  unconditionally need a bounce buffer (a decrypted memory area), and for
  the 32-bit variants, "DmaMemoryTop" should be lowered regardless of the
  location of the original (encrypted) buffer.

- The current logic would be hard to extend for the in-place decryption
  that we'll implement in the next patch.

Therefore rework the "MapInfo->PlainTextAddress" setup. No functional
changes beyond said bugfixes.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
OvmfPkg/IoMmuDxe/AmdSevIoMmu.c