From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DF9F821E49037 for ; Wed, 14 Mar 2018 02:27:38 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2018 02:34:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,469,1515484800"; d="scan'208";a="24534644" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.46]) by orsmga007.jf.intel.com with ESMTP; 14 Mar 2018 02:34:00 -0700 From: Star Zeng To: edk2-devel@lists.01.org Cc: Star Zeng , Ruiyu Ni , Hao Wu Date: Wed, 14 Mar 2018 17:33:52 +0800 Message-Id: <1521020038-102684-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [PATCH V2 0/6] SourceLevelDebugPkg DebugUsb3: Re-Support IOMMU X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2018 09:27:39 -0000 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 Cc: Hao Wu 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