Reviewed-by: Star Zeng <[email protected]> to MdeModulePkg changes.

-----Original Message-----
From: Laszlo Ersek [mailto:[email protected]] 
Sent: Friday, September 8, 2017 6:41 AM
To: edk2-devel-01 <[email protected]>
Cc: Ard Biesheuvel <[email protected]>; Brijesh Singh 
<[email protected]>; Dong, Eric <[email protected]>; Yao, Jiewen 
<[email protected]>; Justen, Jordan L <[email protected]>; Zeng, 
Star <[email protected]>
Subject: [PATCH 00/10] MdeModulePkg, OvmfPkg: unmap DMA buffers at 
ExitBootServices

Repo:   https://github.com/lersek/edk2.git
Branch: iommu_exit_boot

This series is the result of the discussion under

  [edk2] [PATCH 0/4] MdeModulePkg: some PCI HC drivers: unmap common
                     buffers at ExitBootServices()
  https://lists.01.org/pipermail/edk2-devel/2017-September/014099.html

At ExitBootServices(), PCI and VirtIo drivers should only care about aborting 
pending DMA on the devices. Cleaning up PciIo mappings (which ultimately boil 
down to IOMMU mappings) for those aborted DMA operations should be the job of 
the IOMMU driver.

Patches 01 through 03 clean up the AtaAtapiPassThru driver in MdeModulePkg a 
little bit, because at present, (a) it unmaps the buffers and disables BMDMA in 
the wrong order in its DriverBindingStop() function, (b) it doesn't abort 
pending DMA at ExitBootServices().

This subset can be treated separately from the rest of the series, but I 
thought they belonged loosely together (given that AtaAtapiPassThru is used on 
QEMU's Q35 machine type).

Patches 04 through 07 remove VIRTIO_DEVICE_PROTOCOL.UnmapSharedBuffer()
calls from the VirtIo drivers' ExitBootServices() handlers.

(The conversion of VirtioNetDxe to device addresses is still in progress
-- Brijesh, when you submit v2 of that, under this approach, there is no need 
to change VirtioNetExitBoot() relative to current upstream, and you can use 
VirtioOperationBusMasterRead to map outgoing packets.)

Patches 08 through 10 make OvmfPkg/IoMmuDxe track all mappings, and unmap all 
mappings (Read, Write, CommonBuffer) that are in effect when
ExitBootServices() is called. It is ensured that PCI and VirtIo drivers abort 
pending DMA first, and IoMmuDxe clean up the mappings last.

Cc: Ard Biesheuvel <[email protected]>
Cc: Brijesh Singh <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Jordan Justen <[email protected]>
Cc: Star Zeng <[email protected]>

Thanks
Laszlo

Laszlo Ersek (10):
  MdeModulePkg/AtaAtapiPassThru: cache EnabledPciAttributes
  MdeModulePkg/AtaAtapiPassThru: unmap DMA buffers after disabling BM
    DMA
  MdeModulePkg/AtaAtapiPassThru: disable the device at
    ExitBootServices()
  OvmfPkg/VirtioBlkDxe: don't unmap VRING at ExitBootServices()
  OvmfPkg/VirtioGpuDxe: don't unmap VRING & BackingStore at
    ExitBootServices
  OvmfPkg/VirtioRngDxe: don't unmap VRING at ExitBootServices()
  OvmfPkg/VirtioScsiDxe: don't unmap VRING at ExitBootServices()
  OvmfPkg/IoMmuDxe: track all mappings
  OvmfPkg/IoMmuDxe: generalize IoMmuUnmap() to IoMmuUnmapWorker()
  OvmfPkg/IoMmuDxe: unmap all IOMMU mappings at ExitBootServices()

 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 103 +++++---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h |   7 +
 OvmfPkg/IoMmuDxe/AmdSevIoMmu.c                           | 246 
+++++++++++++++++---
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c                         |   7 +-
 OvmfPkg/VirtioGpuDxe/Commands.c                          |  23 +-
 OvmfPkg/VirtioRngDxe/VirtioRng.c                         |   7 +-
 OvmfPkg/VirtioScsiDxe/VirtioScsi.c                       |   7 +-
 7 files changed, 299 insertions(+), 101 deletions(-)

--
2.14.1.3.gb7cf6e02401b

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to