The patch series is also at
https://github.com/lzeng14/edk2 DebugCommUsb3AfterIOMMUV2 branch.

Based on the feedbacks from Ray and Hao.
It is V2 of
https://lists.01.org/pipermail/edk2-devel/2018-March/022586.html.
It has no essential difference with V1 about the final code, but
re-arranges the patches to revert old IOMMU support patches and
then re-support IOMMU.

de8373fa07f87ca735139bb86c51e2c29fb1d956 could not handle two cases.
1. For the case that the USB3 debug port instance and DMA buffers are
from PEI HOB with IOMMU enabled, it was to reallocate the DMA buffers
by AllocateAddress with the memory type accessible by SMM environment.
But reallocating the DMA buffers by AllocateAddress may fail.

2. At S3 resume, after the code is transferred to PiSmmCpuDxeSmm from
S3Resume2Pei, HOB is still needed to be used for DMA operation, but
PiSmmCpuDxeSmm has no way to get the HOB at S3 resume.

The patch is to re-support IOMMU.
For PEI, allocate granted DMA buffer from IOMMU PPI, register IOMMU PPI
notification to reinitialize hardware with granted DMA buffer if IOMMU
PPI is not present yet.
For DXE, map DMA buffer by PciIo in PciIo notification for early DXE,
and register DxeSmmReadyToLock notification to reinitialize hardware
with granted DXE DMA buffer accessible by SMM environment for late DXE.

DebugAgentLib has been managing the instance as Handle in
HOB/SystemTable. The Handle(instance) from DebugAgentLib can be used
directly in DebugCommunicationLibUsb3. Then DebugCommunicationLibUsb3
could get consistent Handle(instance) from DebugAgentLib.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Cc: Hao Wu <hao.a...@intel.com>

Star Zeng (6):
  Revert "DebugUsb3: Check mUsb3Instance before dereferencing it"
  Revert "DebugUsb3: Fix GCC build failures"
  Revert "DebugUsb3: Support IOMMU"
  SourceLevelDebugPkg DebugUsb3: Re-Fix GCC build failures
  SourceLevelDebugPkg DebugCommUsb3: Refine some formats/comments
  SourceLevelDebugPkg DebugUsb3: Re-Support IOMMU

 .../DebugCommunicationLibUsb3Common.c              | 110 +++++-
 .../DebugCommunicationLibUsb3Dxe.c                 | 375 ++++++++++++---------
 .../DebugCommunicationLibUsb3Dxe.inf               |  11 +-
 .../DebugCommunicationLibUsb3Internal.h            |  60 +---
 .../DebugCommunicationLibUsb3Pei.c                 |  50 ++-
 .../DebugCommunicationLibUsb3Pei.inf               |   4 +-
 6 files changed, 351 insertions(+), 259 deletions(-)

-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to