From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 21E3B21E49044 for ; Wed, 14 Mar 2018 02:41:33 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2018 02:47:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,469,1515484800"; d="scan'208";a="208096525" Received: from ray-dev.ccr.corp.intel.com (HELO [10.239.9.4]) ([10.239.9.4]) by orsmga005.jf.intel.com with ESMTP; 14 Mar 2018 02:47:54 -0700 To: Star Zeng , edk2-devel@lists.01.org Cc: Hao Wu References: <1521020038-102684-1-git-send-email-star.zeng@intel.com> From: "Ni, Ruiyu" Message-ID: Date: Wed, 14 Mar 2018 17:47:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1521020038-102684-1-git-send-email-star.zeng@intel.com> Subject: Re: [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:41:34 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 3/14/2018 5:33 PM, Star Zeng wrote: > 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(-) > Reviewed-by: Ruiyu Ni -- Thanks, Ray